home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir36 / skey40.zip / BATUTIL.DOC next >
Text File  |  1993-01-07  |  387KB  |  8,877 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.            BBBBBB    AAA    TTTTTT  UU  UU  TTTTTT   IIII  LLLL    (tm)
  7.             BB BBB  AA AA   T TT T  UU  UU  T TT T    II    LL
  8.             BB  BB AA   AA    TT    UU  UU    TT      II    LL
  9.             BBBBB  AA   AA    TT    UU  UU    TT      II    LL
  10.             BB  BB AAAAAAA    TT    UU  UU    TT      II    LL
  11.             BB BBB AA   AA    TT    UU  UU    TT      II    LL  LL
  12.            BBBBBB  AA   AA   TTTT    UUUU    TTTT    IIII  LLLLLLL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                   Version 4.0
  19.  
  20.                                CTRLALT Associates   (R)
  21.  
  22.                               _______
  23.                          ____|__     |               (R)
  24.                       --|       |    |-------------------
  25.                         |   ____|__  |  Association of
  26.                         |  |       |_|  Shareware
  27.                         |__|   o   |    Professionals
  28.                       -----|   |   |---------------------
  29.                            |___|___|    MEMBER
  30.  
  31.  
  32.  
  33.  
  34.  
  35.       TABLE OF CONTENTS
  36.  
  37.       Chapter I:OVERVIEW........................................3
  38.          I.1 Shareware Considerations...........................3
  39.          I.2 What BATUTIL does..................................6
  40.          I.3 Help and Verbose Modes and European Dates..........9
  41.          I.4 New in Version 4.0................................11
  42.          I.5 Basic Syntax......................................13
  43.          I.6 Setting BATUTIL options from the environment......16
  44.          I.7 Reading commands from a file......................17
  45.          I.8 BATUTIL's line editor.............................19
  46.          I.9 BUSIC - a first look..............................20
  47.          I.10 String manipulation, arithmetic and
  48.                       date arithmetic..........................22
  49.          I.11 Control Break handling...........................23
  50.       Chapter II:SYSTEM INFORMATION............................25
  51.          II.1 Overview.........................................25
  52.          II.2 Time.............................................26
  53.          II.3 Operating System and Memory Information..........26
  54.          II.4 Console Information..............................29
  55.          II.5 Hardware Information.............................31
  56.          II.6 File Information.................................32
  57.          II.7 The RUn Command..................................34
  58.          II.8 TOdayfile and MAkefile...........................37
  59.          II.9 The ERrorlevel command...........................38
  60.       Chapter III: DISPLAY TOOLS...............................39
  61.          III.1 Overview........................................39
  62.          III.2 Metastring Translation..........................39
  63.          III.3 BATUTIL's ECho Command..........................43
  64.          III.4 The BOx Command.................................45
  65.          III.5 The PRetty Command..............................46
  66.          III.6 Bigecho.........................................47
  67.          III.7 Getting Echo/Pretty Input from a File...........50
  68.          III.8 Cursor Position and Hiding the Cursor...........50
  69.          III.9 The STdout Command..............................51
  70.          III.10 Sounds.........................................52
  71.       Chapter IV:USER INPUT....................................54
  72.          IV.1 Menu Basics......................................54
  73.          IV.2 Getting a Menu from a File.......................55
  74.          IV.3 Menu Options.....................................56
  75.          IV.4 GEtkey Basics....................................58
  76.          IV.5 GEtkey Options...................................60
  77.          IV.6 AScii, SCanread..................................63
  78.          IV.7 USername/Password Checking.......................63
  79.          IV.8 Parameter Matching...............................64
  80.          IV.9 Querying the Lock Status.........................65
  81.  
  82.  
  83.  
  84.  
  85.       Chapter V:ENVIRONMENTAL CONTROL..........................67
  86.          V.1 Environmental Impact Statement....................67
  87.          V.2 Environment Reports...............................69
  88.          V.3 SEt Basics........................................70
  89.          V.4 Internal Variables and Hacker Mode................71
  90.          V.5 Getting User Strings into the Environment.........72
  91.          V.6 Using the File Pick List..........................75
  92.          V.7 Saving and Loading the Environment to a File......76
  93.          V.8 Batch File Path Control...........................78
  94.          V.9 Direct Editing of the Path........................79
  95.          V.10 Direct Editing of the Environment................80
  96.       Chapter VI:BUSIC.........................................81
  97.          VI.1 Internal Variables...............................81
  98.          VI.2 String Manipulation..............................82
  99.          VI.3 Arithmetic.......................................84
  100.          VI.4 Date Arithmetic..................................86
  101.          VI.5 Reading from and Writing to Files................88
  102.          VI.6 BUSIC Summary and Overview.......................90
  103.          VI.7 LABELS, GOTO and CALL............................92
  104.          VI.8..IF...THEN...ELSE and CASE.......................94
  105.          VI.9..FOR, REPEAT and WHILE...........................96
  106.          VI.10 FOR Loops with Lists, Files and Directories.....98
  107.          V.11 Internal Structure...............................99
  108.          VI.12 Trace Mode.....................................102
  109.          VI.13 Hacker Mode....................................105
  110.       Chapter VII:TIPS AND EXAMPLES...........................106
  111.          VII.1 General tips...................................106
  112.          VII.2 Returning to your Initial Directory............106
  113.          VII.3 Using BATUTIL in your autoexec.bat.............107
  114.          VII.4 A Clean Sweep..................................108
  115.          VII.5 Directory Lister with Smart Wildcards..........109
  116.          VII.6 A Two Year Olds' Delight.......................109
  117.          VII.7 Sample Batch Files.............................110
  118.       Chapter VIII:COMMAND REFERENCE..........................112
  119.       Chapter IX:ERROR MESSAGES...............................154
  120.          IX.1 Fatal Errors....................................154
  121.          IX.2 List of Error Codes.............................154
  122.          IX.3 Explanation of Error Codes......................155
  123.  
  124.  
  125.                         Chapter I:OVERVIEW
  126.  
  127.  
  128.       I.1 Shareware Considerations
  129.  
  130.             BATUTIL is a program included in the STACKEY package by
  131.       CTRLALT Associates.  If you are a shareware evaluator, we appreciate
  132.       your taking the time to try out this program.  We'd like you to skim
  133.       this section before going to the next that actually tells you what
  134.       BATUTIL does.
  135.  
  136.             Full details as to warranty and license terms can be found in
  137.       the STACKEY documentation.  BATUTIL is shareware. You have a 30 day
  138.       trial period from the time that you first use the program to see if
  139.       it meets your needs.  If you continue to use it after that time you
  140.       are required to pay a license fee not as a contribution but because
  141.       you are getting use from our program.  Shareware is dedicated to the
  142.       idea that users are best served by a chance to fully try out
  143.       something as complex and individualistic as software before they buy
  144.       it and that authors are served by an ethic that encourages wide
  145.       copying for trial runs.  But in order for the system to work you need
  146.       to respect the trust that we show in you and register if you continue
  147.       to use our program.  BATUTIL can only be registered as part of the
  148.       STACKEY package.
  149.  
  150.             License fees are as follows:
  151.       License to BATUTIL/STACKEY with printed documentation     $49
  152.       Shipping and handling is extra: $4 in the US and Canada and $13
  153.       elsewhere to cover air shipping outside the United States.
  154.       Registered users of Version 1.0 may upgrade for $29 plus S&H.  We
  155.       have special registration arrangements you can use if you choose in
  156.       Australia and the United Kingdom - these are also described in the
  157.       STACKEY docs.
  158.  
  159.             All licensing will get you the latest version on disk.  The
  160.       printed documentation is essentially identical to the documentation
  161.       on disk.  Basically, you cannot distribute BATUTIL as part of a
  162.       package of goods or services for which you charge a fee without one
  163.       of the following:
  164.             -  a separate license for each person receiving the program
  165.             -  the right to distribute this program as shareware for a fee
  166.             -  an arrangement with Ctrlalt Associates
  167.       Details are in the STACKEY documentation and in the vendor.doc file.
  168.       These restriction do NOT apply to copies you give for NO fee to
  169.       others for shareware evaluation.
  170.  
  171.  
  172.  
  173.  
  174.       Chapter I:OVERVIEW                                          Page 3
  175.  
  176.  
  177.  
  178.  
  179.                         Documentation for BATUTIL, Version 4.0
  180.  
  181.  
  182.             You may register by phoning or writing
  183.  
  184.             Advanced Support Group
  185.             11900 Grant Place
  186.             Des Peres, MO 63131
  187.             1(800)788-0787
  188.             1(314)965-5630
  189.             FAX 1(314)966-1833
  190.  
  191.       Mastercard/Visa/Discover/AmEx and purchase orders from approved
  192.       institutions are accepted.   This is not the number for support (see
  193.       below).
  194.  
  195.             Payment of the license fee gives you the right to use any
  196.       version of BATUTIL with a major version number of 4.  If there is a
  197.       Version 5, an update fee may be required.  In addition to the thirty
  198.       day trial period, you may return the disks (and printed
  199.       documentation) for a full refund if you are not totally satisfied
  200.       for a period of 90 days after initial payment.  You have the choice of
  201.       one of two license terms: "use like a book" OR a single user license.
  202.       The former allows you to place copies of this software on as many
  203.       machines as you wish so long as there is NO CHANCE that more than one
  204.       copy of BATUTIL will be loaded into any of the machine's memories at
  205.       one time.  The latter allows you to place copies on all machines for
  206.       which YOU are the principal user even if there is a chance that
  207.       OCCASIONALLY more than one copy is in use (for example, if you use
  208.       BATUTIL on a office machine while a family member might OCCASIONALLY
  209.       use a copy on a home machine at the same time).
  210.  
  211.             The 800 number is for orders only.  Registered users may
  212.       obtain support in three ways: by writing to CTRLALT Associates or via
  213.       Compuserve and via a 900 telephone number.  Details can be found in
  214.       the STACKEY documentation.   In particular, Ctrlalt Associates have a
  215.       section (Section 12) on Compuserve's PCVENA forum - leave messages
  216.       there for 76004,1664.   Compuserve and mail support are free of
  217.       charges other than postage or Compuserve connect time.  There is a
  218.       $2/minute charge for calling the 900 number (initial 24 secs are free).
  219.       This support is offered by Advanced Support Group in cooperation with
  220.       Ctrlalt Associates.  (Note: the 800 is for orders/registration only
  221.       and cannot be used for support.)
  222.  
  223.             If you like the program, please give it to your friends,
  224.       place it on bulletin boards and otherwise spread it around.  We
  225.       explicitly allow TRIAL use of it privately and in a commercial
  226.  
  227.  
  228.       Chapter I:OVERVIEW                                          Page 4
  229.  
  230.  
  231.  
  232.  
  233.                         Documentation for BATUTIL, Version 4.0
  234.  
  235.  
  236.       environment.  You may give it away, but you may not charge for it or
  237.       include it with commercial software without our written permission.
  238.       An exception is made for user groups and shareware software
  239.       distributors who are approved shareware distributors of the
  240.       Association of Shareware Professionals, an organization to which both
  241.       authors of BATUTIL belong.  Details on these restrictions, ASP and
  242.       information on the ASP Ombudsman can be found in the STACKEY
  243.       documentation.
  244.  
  245.             The following names may be trademarked: Turbo Pascal, Turbo
  246.       Professional, Turbo Plus, Pianoman, Desqview, Omniview, Software
  247.       Carousel, Techhelp, Flambeaux Software, Intel, Microsoft, Lotus,
  248.       123, List, Ultravision, 4DOS, Qemm, 386Max, Eemram.  BATUTIL, and
  249.       STACKEY are trademarks of and Ctrlalt is a registered trademark of
  250.       Ctrlalt Associates.
  251.  
  252.             BATUTIL was written in Turbo Pascal.  Extensive use was made of
  253.       the routines in Object Professional published by Turbo Power Software
  254.       and of Turbo Plus published by Nostradamus.  The tunes used in the
  255.       sound command were developed with Pianoman, a shareware program
  256.       by Neil Rubinking.
  257.  
  258.             We would like to thank Quarterdeck Office Systems for providing
  259.       information on the programming interface to Desqview, and Scott
  260.       Bussinger and Kim Kokkonen for comments on our Ctrl-Break handler.
  261.  
  262.             BATUTIL is warranted for no particular purpose.  While we
  263.       have tried to make the program bug free, no software can be
  264.       guaranteed to be free of bugs.  Due to the complex nature of
  265.       computer software CTRLALT ASSOCIATES does not warrant that the
  266.       licensed Software is completely error-free, will operate without
  267.       interruption, or is compatible with all equipment and software
  268.       configurations.  Repair, replacement or refund, at the option of
  269.       the CTRLALT ASSOCIATES, is the exclusive remedy of the customer, in
  270.       the event of a defect.  By using this program, you accept it AS IS
  271.       and agree that we will NOT be held responsible for any damages
  272.       including but not limited to consequential damages or loss of data.
  273.       This includes damages caused by problems of which CTRLALT
  274.       Associates is already aware.  We will attempt to correct any bug
  275.       which is pointed out to us.  Registered users are entitled to use
  276.       bug fixes while still numbered 4.xx.  We do not intend to support
  277.       Version 4.xx once a Version 5.xx is available and you may need to
  278.       pay an upgrade fee to a new version if there are any bug fixes made
  279.       once Version 5.xx is available.  We will endeavour to continue to
  280.  
  281.  
  282.       Chapter I:OVERVIEW                                          Page 5
  283.  
  284.  
  285.  
  286.  
  287.                         Documentation for BATUTIL, Version 4.0
  288.  
  289.  
  290.       support registered users of Version 1.0 who choose not to upgrade but
  291.       will not attempt to fix any problems in that version but instead fix
  292.       the current version.
  293.  
  294.             You may ask for a full refund of your registration for a period
  295.       up to 90 days after you register but only if you return the program
  296.       package sent registered users and agree to destroy any copies of
  297.       BATUTIL and STACKEY in your possession and cease using the programs.
  298.       While we have attempted to make this documentation as clear as
  299.       possible, we cannot guarantee that there will not be misunderstanding
  300.       or user error.
  301.  
  302.             We specifically exclude any warranties, EXPRESS OR IMPLIED,
  303.       including the IMPLIED WARRANTIES OF MERCHANTABILITY or FITNESS FOR
  304.       A PARTICULAR PURPOSE.  SOME STATES DO NOT ALLOW THE IMPLIED
  305.       WARRANTIES TO BE EXCLUDED.  CONSULT A LAWYER TO SEE WHETHER OR NOT
  306.       THE ABOVE EXCLUSIONS APPLY TO YOU IN YOUR STATE.
  307.  
  308.  
  309.       I.2 What BATUTIL does
  310.  
  311.             BATUTIL is a program with two purposes: to give you power
  312.       inside your batch files and to give you more control over the DOS
  313.       environment.  To get a feel for the program, please run budemo which
  314.       is included with the distribution files.
  315.  
  316.             Included in the information that you can get returned in either
  317.       the DOS errorlevel, stored in BATUTIL's internal variables or an
  318.       environmental variable are
  319.             -  current time, date, day of the week
  320.             -  total amount and amount free of disk space, memory and EMS
  321.             -  CPU type and type of coprocessor if present
  322.             -  whether a file exists not only in the current directory
  323.       but on the DOS path and if it exists on the DOS path, the actual
  324.       directory can be returned in another environmental variable
  325.             -  whether a file has today's date or not
  326.             -  whether one of two files is older than another
  327.             -  you can parse a filespec into individual components
  328.             -  you can do arithmetic on integers and dates
  329.             -  you can manipulate strings including case change and
  330.       centering
  331.             -  whether Desqview or Carousel is running and, if, so which
  332.       partition you are in; whether Windows is running underneath you
  333.  
  334.  
  335.  
  336.       Chapter I:OVERVIEW                                          Page 6
  337.  
  338.  
  339.  
  340.  
  341.                         Documentation for BATUTIL, Version 4.0
  342.  
  343.  
  344.             Some of these options may not seem so useful at first sight,
  345.       but, for example, whether a file has today's date or not can be used
  346.       to make a routine that will only get run once per day.  Chapter VII
  347.       will explain sample uses of BATUTIL.
  348.  
  349.             Central to the design of BATUTIL is the notion of "high level"
  350.       language.  There are much more sophisticated batch languages
  351.       available and in them one can write menus at least as involved as
  352.       are available in BATUTIL's MENU command.  But doing so requires you
  353.       to write a little program in the batch language while MENU is a
  354.       built in command of BATUTIL.  If you want to, BATUTIL comes with a
  355.       full featured language dubbed BUSIC including, IF..THEN..ELSE, CASE,
  356.       WHILE, REPEAT and GOTO all of which can be used in the style of DOS
  357.       batch languages.
  358.  
  359.             In addition to getting information from the operating system,
  360.       you can pass information to and get information from the user.
  361.       BATUTIL gives you considerable control over displaying information
  362.       including the possibility of turning the cursor on and off and
  363.       displaying messages in various colors.  And BATUTIL understands
  364.       the metastrings that STACKEY does so you can easily display data
  365.       like today's date in English.
  366.  
  367.             As for user input it can be obtained in various forms
  368.             -  There is a getkey routine that lets you list a set of keys
  369.       using STACKEY syntax and get which key in the list the user has hit
  370.             -  whether a lock key is currently pressed
  371.             -  with some simple commands, you can popup an elegant menu
  372.       for the user to pick from and have the choice returned in the
  373.       errorlevel
  374.             -  You can have the user input a string and get it stored in
  375.       the environment
  376.             -  You can have the user type in a user name or password and
  377.       see whether it matches a predetermined list and have which item is
  378.       matched reported in the errorlevel
  379.             -  You can popup a filename list for the user to choose from
  380.       and have the answer stored in the environment
  381.  
  382.             BATUTIL also gives you considerable control over the DOS
  383.       environment.  It is able to do this by using undocumented features
  384.       of the operating system.  As always, such features should be used
  385.       with care.  PLEASE READ CAREFULLY THE WARNING AT THE START OF
  386.       CHAPTER V CONCERNING USING UNDOCUMENTED FEATURES TO ACCESS THE DOS
  387.       ENVIRONMENT.  BATUTIL's environmental control has been tested with
  388.  
  389.  
  390.       Chapter I:OVERVIEW                                          Page 7
  391.  
  392.  
  393.  
  394.  
  395.                         Documentation for BATUTIL, Version 4.0
  396.  
  397.  
  398.       PCDOS Version 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 5.0 and some flavors
  399.       of MSDOS.  Besides being able to place information into the
  400.       environment via user input, BATUTIL will
  401.             - display more information about the environment than the SET
  402.       command
  403.             - allow you to put strings in the environment up to a length
  404.       of 255 characters rather than the 127 character maximum that DOS
  405.       allows.  In particular, with BATUTIL, your PATH string can be up to
  406.       250 characters rather than the 122 characters that you can enter
  407.       with DOS.  (While DOS doesn't care about long paths, you may have an
  408.       application program that does and crashes if it finds a path over
  409.       127 bytes).
  410.             - allow simple commands to add a directory to your PATH
  411.       without inadvertently adding one already there and allow deletion
  412.       of a directory from your PATH
  413.             - allow full screen editing of your environment and PATH.
  414.             - allow you to save the environment to a file, to load or
  415.       merge a file into the environment and to kill the environment (use
  416.       with care).
  417.  
  418.             The files in the BATUTIL package are as follows:
  419.                 BATUTIL.EXE     The basic program.  The only file
  420.                                   required to use BATUTIL
  421.                 BATUTIL.HLP     Online help called by BATUTIL if you
  422.                                   use BATUTIL ? or BATUTIL !; SEE BELOW
  423.                 BATUTIL.DOC     Documentation in electronic form
  424.                 BUDEMO.BAT      Sample batch file which will call
  425.                                   the other sample batch files
  426.                 COLORDEM.BAT    Sample batch file shows color capability
  427.                 EQUIP.BAT       Sample batch file shows ability to read
  428.                                   hardware
  429.                 INPUTDEM.BAT    Sample batch file shows ability to get
  430.                                   input from the user
  431.                 MENUDEMO.BAT    Sample batch file shows BATUTIL's menu
  432.                                   making capability
  433.                 SHOWDEMO.BAT    Sample batch file shows display options
  434.                                   including big characters and metastrings
  435.                 SOUNDEMO.BAT    Sample batch file with BATUTIL's 20
  436.                                   sounds/tunes
  437.                 LANGDEMO.BAT    Sample batch file demonstrating the new
  438.                                   language features of BATUTIL 4.0
  439.                 WHATEL.EXE      Program described in Section II.7 to
  440.                                   determine errorlevel and timing for
  441.                                   some command
  442.  
  443.  
  444.       Chapter I:OVERVIEW                                          Page 8
  445.  
  446.  
  447.  
  448.  
  449.                         Documentation for BATUTIL, Version 4.0
  450.  
  451.  
  452.             Because of our desire to keep the basic files on a single disk
  453.       and to keep download time low, we are encouraging distribution of a
  454.       'small' shareware version without the BATUTIL.HLP file.  If you got a
  455.       version without this file and want it for evaluation, it can be
  456.       downloaded from our support section of Compuserve as BUHELP.EXE
  457.       (Section 12 of PCVENA) or gotten from many disk vendors including PBS
  458.       (1-800-426-3475).  If you upload this program to a BBS, please keep
  459.       BATUTIL.HLP as a separate file.
  460.  
  461.             BATUTIL, its help file and documentation are copyright 1988-
  462.       91 by Barry Simon and Richard Wilson, all rights reserved.
  463.  
  464.             If you obtain BATUTIL/STACKEY from Advanced Support Group,
  465.       directions for installing the programs can be found in the STACKEY
  466.       docs and with a readme.com file.
  467.  
  468.       *******************************************************************
  469.                                 IMPORTANT NOTES
  470.             Users of 4DOS Version 2.x; please read Section V.1 before
  471.       calling for technical support.
  472.             See Section I.4 for items in Version 1 not carried over to
  473.       Version 4.x.
  474.       *******************************************************************
  475.  
  476.  
  477.       I.3 Help and Verbose Modes and European Dates
  478.  
  479.             You can obtain interactive help for BATUTIL by typing in
  480.               batutil ?
  481.       or
  482.               batutil !
  483.       at the DOS prompt.  To obtain help, the binary file BATUTIL.HLP
  484.       must be available in the current directory or the directory where
  485.       BATUTIL is loaded or in your path.  BATUTIL looks for the first two
  486.       non-blank characters following the ? (or !) and if they are a valid
  487.       BATUTIL command, you will be immediately sent to the help for that
  488.       command; otherwise, the main help menu will be displayed.  For
  489.       example
  490.             batutil ? SE
  491.       would display help for BATUTIL's SET command as would
  492.             batutil ?see the beautiful program
  493.  
  494.             BATUTIL ? displays the menu oriented help with various
  495.       special effects.  If these effects and the slightly longer time
  496.  
  497.  
  498.       Chapter I:OVERVIEW                                          Page 9
  499.  
  500.  
  501.  
  502.  
  503.                         Documentation for BATUTIL, Version 4.0
  504.  
  505.  
  506.       they take bother you, batutil ! will display help without the
  507.       special fades for displaying material.
  508.  
  509.             The help program uses color attributes on a graphics monitor.
  510.       If you have a two color graphics monitor (such as on a laptop) or
  511.       the colors are hard to see, the help program will use monochrome
  512.       attributes if you use
  513.             SET BU!=bw
  514.       in your autoexec.bat file or at the DOS command line before running
  515.       BATUTIL.  Note that on a true monochrome adapter (IBM MDA or
  516.       Hercules monographics card), the help program will not use color
  517.       attributes whether you use that set command or not.
  518.  
  519.             Normally, BATUTIL exits when there is an error and sets the
  520.       errorlevel between 200 and 253; see the discussion in Chapter IX.
  521.       There are three levels of visual error reporting that you can have
  522.       turned on.  For debugging purposes the default is a verbose mode
  523.       where BATUTIL will explain why it is exiting.  For batch files you
  524.       distribute you may want to have verbose mode turned off and instead
  525.       use a Quiet mode where no messages are displayed.  To turn on this
  526.       quiet mode, just make the first non blank character in the command
  527.       line the letter Q.  Thus,
  528.             batutil {}
  529.       would display an error message while
  530.             batutil Q {}
  531.       would exit without any message.  For distributed batch files made
  532.       with BATUTIL, you may want to turn on quiet mode using an
  533.       environmental variable as described in Section I.5. Command line
  534.       mode takes precedence over any mode set in the environment and, in
  535.       particular, you can override the mode set in the environment and
  536.       restore to the default Verbose mode by making V the first letter on
  537.       the command line after "BATUTIL".
  538.  
  539.             Chapter IX has a complete list of error codes with an
  540.       explanation of each.  The online help main menu has an option to
  541.       list all error numbers and their meaning.
  542.  
  543.             In batch files, the error message may disappear too fast for
  544.       you to see.  In addition to Verbose mode, BATUTIL has a Pause mode
  545.       which shows the error message and waits for a key before exiting.
  546.       Pause mode is set with the letter P.
  547.  
  548.             To see the information which BATUTIL is placing in the
  549.       environment while testing out what a command will do the following
  550.  
  551.  
  552.       Chapter I:OVERVIEW                                         Page 10
  553.  
  554.  
  555.  
  556.  
  557.                         Documentation for BATUTIL, Version 4.0
  558.  
  559.  
  560.       one line batch file (or an equivalent CED synonym) is useful:
  561.             batutil %1 %2 %3 %4 %5 %6 %7 %8 %9 {EC $x(rc)}
  562.       The final command echoes the current value of the environmental
  563.       variable RC to the screen.
  564.  
  565.             There is an additional special parameter you can use at the
  566.       start of the command line - E for European.  It will change to
  567.       European date conventions so, while
  568.             batutil {ec $E}
  569.       would echo
  570.             December 19, 1991
  571.       the command
  572.             batutil E {ec $E}
  573.       would echo
  574.             19 December 1991
  575.  
  576.             The E command effects the following: the meaning of $d, $E and
  577.       the translation used for dates, for example
  578.             batutil {ec $E(1/2/91)}
  579.       returns
  580.             January 2, 1991
  581.       while
  582.            batutil E {ec $E(1/2/91)}
  583.       returns
  584.            1 February 1991
  585.       since 1/2/91 is also translated using European conventions.
  586.  
  587.  
  588.       I.4 New in Version 4.0
  589.  
  590.             Version 1.0 was released bundled with Stackey 3.0 and this
  591.       numbering caused some confusion so, with this upgrade, we have upped
  592.       the version number of BATUTIL all the way to 4.0 to make the numbers
  593.       the same.
  594.  
  595.             The most significant differences in this new version are the
  596.       addition of a built in language described further in Sections I.9,
  597.       I.10 and Chapter VI.  For this language to work effectively, we
  598.       needed to remove the restriction of a single 127 character command
  599.       line and it is now possible to read commands in from a file as
  600.       described in Section I.7.  As a bonus, you need not load BATUTIL many
  601.       times and that increases the speed of command processing by a
  602.       considerable amount.
  603.  
  604.  
  605.  
  606.       Chapter I:OVERVIEW                                         Page 11
  607.  
  608.  
  609.  
  610.  
  611.                         Documentation for BATUTIL, Version 4.0
  612.  
  613.  
  614.             This may mean that you'd like to use BATUTIL's RUn command to
  615.       run a program from a BATUTIL batch file without exiting BATUTIL.  In
  616.       Version 1.0, BATUTIL took over 200K when you used RUn limiting it for
  617.       these purposes.  With this version, BATUTIL will swap itself to hard
  618.       disk or EMS memory leaving a core of about 11K in conventional RAM.
  619.       About 300K of disk space or EMS is required.  By default EMS is used
  620.       if available but you can tell BATUTIL to use disk.  This swapping
  621.       mechanism RUn command will not work on systems with floppy only and
  622.       no EMS so you'll have to use the non-swapping mode (set up by
  623.       placing BUSWAP=! in your environment)
  624.  
  625.             Included in the language support are:
  626.                 - Labels and Goto
  627.                 - Calling subroutines
  628.                 - IF..THEN..ELSE and CASE
  629.                 - WHILE and REPEAT
  630.                 - 32 internal variables as well as the use of the DOS
  631.                     environment for storing information
  632.                 - FOR loops using an internal loop variable
  633.                 - FOR loops using a list
  634.                 - FOR loops using file wildcards like DOS batch files
  635.                 - FOR loops varying through a directory tree
  636.                 - An interactive trace mode
  637.                 - String manipulation including change of case, length,
  638.                     formatting, searching, and word count
  639.                 - Integer arithmetic with four functions, mod and power
  640.                 - Date manipulation including date arithmetic
  641.                 - Reading and writing to files with optional metastring
  642.                     translation
  643.                 - reading from the screen
  644.                 - Memory peeks and pokes
  645.                 - I/O port peeks and pokes
  646.  
  647.             Other new features include
  648.                 - reading the number of file handles and DOS buffers
  649.                 - determining if BATUTIL is running in a Windows DOS box
  650.                 - determining if Norton's NDOS is running
  651.                 - determining if SHARE is loaded
  652.                 - determining the value of last drive
  653.                 - A command to display text boxes with choice of frame
  654.                     characters and shadows
  655.                 - mouse support in the $F routines
  656.                 - a $N metastring like $Q but with input restricted to
  657.                     numbers and a test to see if a string is a number
  658.  
  659.  
  660.       Chapter I:OVERVIEW                                         Page 12
  661.  
  662.  
  663.  
  664.  
  665.                         Documentation for BATUTIL, Version 4.0
  666.  
  667.  
  668.                     between allowed maximum and minimum values
  669.                 - the #I command will now identify 486 CPUs
  670.                 - super metastrings to force commands that do not do
  671.                     metastring translation on their parameters to do such
  672.                     translation after all
  673.                 - menu can now be set to timeout after a fixed time
  674.                 - support for European dates
  675.                 - a password mode for entry of strings which are masked
  676.  
  677.             There have been the following changes from Version 1.0:
  678.                 - Support for Omniview has been dropped
  679.                 - SOund number 1 has changed slightly
  680.                 - HAltif still works for compatibility but is not
  681.                     documented because it is better to use an
  682.                         IF ... THEN GOTO HALT
  683.                     command
  684.                 - The method for identifying second monitors has changed
  685.                     to something that may not work as well on older
  686.                     machines but which works on systems with VGA and later
  687.                     just using BIOS calls
  688.                 - BATUTIL will no longer properly identify 287 chips in a
  689.                     system (rather unusual) where a 386 and 287 are
  690.                     present
  691.  
  692.  
  693.       I.5 Basic Syntax
  694.             Command: REmark
  695.  
  696.             You give BATUTIL a series of commands on the command line or
  697.       read them in from a file.  There are about 130 different commands -
  698.       lest that overwhelm you, we note that many are just giving different
  699.       pieces of hardware information which you'll rarely want and even the
  700.       most complex idea (menus) are controlled by one basic command and
  701.       fewer than ten commands which effect options like whether the menu
  702.       explodes.  Chapter VIII is a detailed alphabetical command reference.
  703.       When you invoke BATUTIL's help, one option is an alphabetical list of
  704.       commands which will give you a panel with syntax and parameters for
  705.       each.
  706.  
  707.             The basic syntax is
  708.               batutil {command1} {command2} ...
  709.       Each command is placed inside braces {} (or square brackets []; see
  710.       below).  On the command lines, the braces are critical - it doesn't
  711.       matter whether you have spaces between } and the next { or not.   For
  712.  
  713.  
  714.       Chapter I:OVERVIEW                                         Page 13
  715.  
  716.  
  717.  
  718.  
  719.                         Documentation for BATUTIL, Version 4.0
  720.  
  721.  
  722.       reading commands from a file, braces are not needed if commands are
  723.       on distinct lines, see Section I.7.
  724.  
  725.             Commands are broken into two classes - normal commands and
  726.       BUSIC language commands.  All normal commands have a two element
  727.       minimal truncation.  That is all normal commands are distinguished
  728.       already in the first two symbols and any substring of the command
  729.       that has at least two letters will work.  For example, the basic
  730.       command to get a report on the environment is
  731.             batutil {envrep}
  732.       The minimal truncation for that is EN so we'll often write ENvrep
  733.       to emphasize this.  Thus
  734.             batutil {en}
  735.       or
  736.             batutil {envr}
  737.       would work just as well as the full name.  The basic commands are
  738.       not case sensitive so {EN} or {En} or even {eNvRe} would do the
  739.       same thing as {envrep}.
  740.  
  741.             While to emphasize minimal truncation, we'll write ENvrep,
  742.       please bear in mind that BATUTIL commands are NOT case sensitive
  743.       although $ metastrings ARE.
  744.  
  745.             The BUSIC language commands: IF, WHILE, CALL, FOR, FORDIR,
  746.       REPEAT, CASE, END, RET, ENDCASE, UNTIL, and BEGIN cannot be
  747.       abbreviated although they are not case sensitive.  In addition to
  748.       avoid accidents the HACKER + command cannot be abbreviated but must
  749.       be used in full.
  750.  
  751.             In addition, much of the metastring translation acts as if it
  752.       were commands - that is there is little difference between the HOur
  753.       command which sets the errorlevel to the current hour and $H which
  754.       returns the current hour in a string so that {HO} and {ER $H} are
  755.       equivalent.
  756.  
  757.             Roughly fifty of the commands return to the user (i.e. you
  758.       as a batch file writer) a number from 0 to 199.  If the command in
  759.       question appears inside {} then that number is stored in the
  760.       environmental variable RC (short for "return code"; environmental
  761.       variable are discussed at the start of Chapter V).  If the command
  762.       appears in [], then BATUTIL will exit without running the rest of
  763.       the command line and place this integer in the DOS errorlevel where
  764.       you can test it with commands like
  765.             if errorlevel ....
  766.  
  767.  
  768.       Chapter I:OVERVIEW                                         Page 14
  769.  
  770.  
  771.  
  772.  
  773.                         Documentation for BATUTIL, Version 4.0
  774.  
  775.  
  776.       (see Chapter VII).  IF THE LAST COMMAND ON THE LINE RETURNS AN
  777.       INTEGER AND IT IS PLACED IN {}, THEN the integer is both placed in
  778.       the real environment and placed in the error level.  For example,
  779.       DRive reports the current drive with 0=A, 1=B, etc.  If the current
  780.       drive is D, then
  781.             batutil .... [DR]
  782.       will set the errorlevel to 3, while
  783.             batutil .....{DR} {echo hi there!}
  784.       would set an environmental variable RC to 3 and then echo "hi
  785.       there!".  Thus if you ran the SET command after BATUTIL, you'd find
  786.       the line
  787.             RC=3
  788.       on your screen.
  789.  
  790.             Every time a command would set the environmental variable RC,
  791.       it also sets the internal variable $r accessible via metastring
  792.       translation.  If you wish to run BATUTIL in a mode where it doesn't
  793.       use the user's environment, the {RC $} command will tell BATUTIL to
  794.       only use $r and not set an environmental RC variable.
  795.  
  796.             Some commands will take optional parameters which also appear
  797.       inside the braces for that command.  Thus @Disk gives the free disk
  798.       space.  If no parameter is specified, then the current default
  799.       drive will be used.  Otherwise you can specify a drive as in
  800.             batutil {@D C}
  801.       BATUTIL will object to incorrect syntax so if you tried
  802.             batutil {@D 3}
  803.       then BATUTIL will exit (with an appropriate message if Verbose mode
  804.       is on).  You can separate the command from the first parameter by
  805.       any of the following:
  806.             <space>,<comma>,= or :
  807.       Rules of separation of multiple parameters for those few commands
  808.       which accept multiple parameters depend on the commands.
  809.  
  810.             Some commands do explicit metastring translation of their
  811.       parameters and others do not.  For any non-BUSIC command, if you
  812.       place the parameters inside $!(...), then metastring translation will
  813.       take place before the parameters are passed on.  Thus even though
  814.       NUmberfiles does not normally do metastring translation, the command
  815.             {NU $!(...)}
  816.       would first do metastring translation on ... and then process the
  817.       command
  818.             {NU ---}
  819.       where --- is the metastring translation of ...  This supermetastring
  820.  
  821.  
  822.       Chapter I:OVERVIEW                                         Page 15
  823.  
  824.  
  825.  
  826.  
  827.                         Documentation for BATUTIL, Version 4.0
  828.  
  829.  
  830.       translation even allows $Q, $N and $F file input.
  831.  
  832.             Before doing anything BATUTIL scans the command line and
  833.       makes sure that every command is a proper one for this version of
  834.       BATUTIL.  If not, it will exit.  Otherwise, it will execute the
  835.       commands one at a time.  It does not check for parameter syntax
  836.       until that command is reached.  Thus {@D 3} will halt BATUTIL when
  837.       reached but earlier commands will already have run.
  838.  
  839.             You may place remarks in the BATUTIL command line by
  840.       enclosing them inside {} with the REmark command as in
  841.             batutil {AT 4F}{CL}{REM clears the screen in red!}
  842.  
  843.  
  844.       I.6 Setting BATUTIL options from the environment
  845.  
  846.             You can effect BATUTIL's behavior with five environmental
  847.       variables: BU@, BU^, B4$, CUR and BUSWAP.  These are set with DOS
  848.       set command or BATUTIL's SEt command.
  849.  
  850.             When BATUTIL loads, before reading the rest of its command
  851.       line, it looks for an environmental string of the form
  852.             BU@=string
  853.       and it first reads that string as if it were a command line and
  854.       places the commands in it to be processed first.  This is intended
  855.       primarily to allow you to change the built in default options to
  856.       some other value.  For example, to turn off beeps and change the
  857.       default on GEtkey from flushing the keyboard to not, you'd use:
  858.             BU@={NB}{NF}
  859.  
  860.             This option is useful if you want to permanently turn on
  861.       pause mode or European date mode; you'd use
  862.             BU@=P E {NB}
  863.       if you wanted to also turn beeps off.
  864.  
  865.             Since BATUTIL looks in the environment, you place the
  866.       information that you want there using the DOS SET command (or
  867.       BATUTIL's SET command if you want!); for example, you might place a
  868.       line
  869.             set BU@=P E {NB}
  870.       in your autoexec.bat file.  It is important to place NO spaces
  871.       between BU@ and the =.  Spaces after the = are unimportant.
  872.  
  873.  
  874.  
  875.  
  876.       Chapter I:OVERVIEW                                         Page 16
  877.  
  878.  
  879.  
  880.  
  881.                         Documentation for BATUTIL, Version 4.0
  882.  
  883.  
  884.             There are four other environmental variables of interest.
  885.       One is the variable B4$.  At the end of the commands to edit your
  886.       path and the environment ({PAthedit} and {EDitenv}) and after using
  887.       help, a screen will appear reminding you of the fact that BATUTIL
  888.       is shareware limited to a 30 day trial period.  You can suppress
  889.       this screen by placing
  890.             B4$=I paid
  891.       in your environment.  Obviously, having told you the secret, you
  892.       can do it even if you haven't paid - let your conscience be your
  893.       guide.  The variable BU^ can be used to turn off ^Break handling;
  894.       see Section I.11.
  895.  
  896.             BATUTIL's RUn command swaps to hard disk or EMS.  You can
  897.       control where swapping takes place with the BUSWAP variable.  This is
  898.       discussed in Section II.7.
  899.  
  900.             The final environmental string that BATUTIL pays attention to
  901.       is CUR (for CURSOR).  It looks for two possibilities:
  902.             CUR=no
  903.       Normally, BATUTIL restores the cursor when exiting, even if you
  904.       have turned it off with the {CU -} command of Section III.7  If
  905.       this string is present the cursor is not turned back on but its
  906.       state is not changed.  The other possibility is
  907.             CUR=off
  908.       When starting or exiting the program, BATUTIL will turn the cursor
  909.       off if this string is found at that point.  All other values of CUR
  910.       are ignored.
  911.  
  912.  
  913.       I.7 Reading commands from a file
  914.             Commands: FCommand, INclude
  915.  
  916.             Four commands are able to read information in from a file.  The
  917.       FCommand command which is equivalent to the INclude command reads new
  918.       commands from a file.  The ECho command displays text on the screen
  919.       in colors you set before the echo command; PRetty displays text in
  920.       colors that you can adjust as part of the string displayed and MEnu
  921.       displays a user defined menu.  The analogous file reading commands
  922.       are FEcho, FPretty and FMenu.  Each command takes two parameters: the
  923.       first is a filename and is required, the second a label name which is
  924.       optional.  If the filename is given without a drive or directory,
  925.       then it is searched for first in the current directory. If not found
  926.       by BATUTIL, BATUTIL will attempt to add an extension of bat and look
  927.       again.  Then the same search is made in the directory that BATUTIL
  928.  
  929.  
  930.       Chapter I:OVERVIEW                                         Page 17
  931.  
  932.  
  933.  
  934.  
  935.                         Documentation for BATUTIL, Version 4.0
  936.  
  937.  
  938.       was loaded from (under DOS 3.0 and later) and finally in the DOS
  939.       path.  If still not found, BATUTIL exits and an error message is
  940.       issued.
  941.  
  942.             If no label name is given, then BATUTIL will start reading and
  943.       processing the file from its beginning.  If a label is given,
  944.       BATUTIL reads the file from the beginning but searches until it
  945.       find a line beginning with
  946.             :label
  947.       (leading spaces before the : are ignored and labels are NOT case
  948.       sensitive).  For example
  949.             batutil {FE foobar.txt hi}
  950.       would look a file named foobar.txt and then search for a line
  951.       starting with
  952.             :hi
  953.       If the label is not found, then BATUTIL exits with an error message.
  954.       Otherwise the file is processed one line at a time until the next
  955.       line beginning with a : is located.  Lines whose first symbol is a ;
  956.       are ignored (i.e. treated as remarks).
  957.  
  958.             You can combine batch file labels and BATUTIL's labels to
  959.       keep the extra lines to display in the batch file itself.  For
  960.       example, the following could be at the start of a batch file:
  961.             goto codestart
  962.             :echostart
  963.             This line will be echoed
  964.             and this will appear on the next line
  965.             ;but this line is a remark
  966.             The last line doesn't have an explicit CR added
  967.             :codestart
  968.             batutil {FEcho %0 echostart}
  969.       Because BATUTIL will add .bat to a filename if it cannot find
  970.       the file without that, the %0 will be properly interpreted (unless
  971.       you happen to have a file with the same name as the batch file and
  972.       no extension).
  973.  
  974.             FEcho, FMenu, and FPretty are limited to reading in 25 or
  975.       fewer lines.  FCommand/INclude will read in up to 1023 commands.  You
  976.       can nest INclude commands to get around the 1023 command limitation
  977.       but BATUTIL is an interpreted language and such large projects should
  978.       normally not be done using such a language.
  979.  
  980.             You can place multiple commands on a single FCommand line by
  981.       separating them with one or more of the four characters [ ] { }.
  982.  
  983.  
  984.       Chapter I:OVERVIEW                                         Page 18
  985.  
  986.  
  987.  
  988.  
  989.                         Documentation for BATUTIL, Version 4.0
  990.  
  991.  
  992.             Please look closely at the demonstration batch files for an
  993.       introduction to how to use the file commands effectively.  A typical
  994.       batch file that only calls BATUTIL command including the RU command
  995.       could have the form:
  996.             @echo off
  997.             batutil {INc %0 code}
  998.             quitbat
  999.             :code
  1000.             BATUTIL commands
  1001.       To make this work, you'd need a zero byte batch file called
  1002.       quitbat.bat in your path (you can make such a file at the DOS command
  1003.       line by typing in
  1004.             rem > quitbat.bat
  1005.  
  1006.             FEcho and FPretty are discussed in Section III.7 and FMenu in
  1007.       Section IV.2.
  1008.  
  1009.             BATUTIL stores the name of the last file you have asked to read
  1010.       commands, echo, pretty or menu from and will reuse it if you use the
  1011.       filename %0 in one of these commands.  See the sample batch files.
  1012.  
  1013.  
  1014.       I.8 BATUTIL's line editor
  1015.  
  1016.             Four of BATUTIL's commands allow editing of line input: the
  1017.       EDenv and PAthedit commands which allow you to edit any
  1018.       environmental variable and your path, the USername command which
  1019.       prompts for a string to be matched and the $Q/$?/$N subcommands of
  1020.       BATUTIL's SEt which place information in the environment.  When
  1021.       such input is asked for the following edit keys are active
  1022.             <Enter> accepts the current string and exits
  1023.             <Esc> restores the original value of the string; if that
  1024.                original value is empty, <Esc> blanks the line except, in
  1025.                that case, <Esc> with a blank line exits and returns an
  1026.                empty string
  1027.             <Left>, <Right> move the cursor by a character
  1028.             <^Left>, <^Right> move the cursor by a word
  1029.             <Home>, <End> to the beginning or end of the line
  1030.             <Ins> toggles insert mode which starts as overwrite mode; the
  1031.                cursor shape indicates what the current mode is
  1032.             <Del> and <Bks> do their usual single character functions
  1033.             <^X> or <^Y> blanks the entire line
  1034.             <^End> blanks to the end of the line
  1035.             <^Home> blanks from the start of the line ot the current
  1036.  
  1037.  
  1038.       Chapter I:OVERVIEW                                         Page 19
  1039.  
  1040.  
  1041.  
  1042.  
  1043.                         Documentation for BATUTIL, Version 4.0
  1044.  
  1045.  
  1046.                 position.
  1047.             <^T> blanks from the cursor position through the next blank
  1048.                 space
  1049.       In addition, WordStar commands are accepted for most of these
  1050.       functions, e.g. ^S is the same as <Left> and the two letter ^QS (or
  1051.       ^Q^S) is the same as <Home>.
  1052.  
  1053.             In situations where the quantity being edited has a prior
  1054.       value, that value is displayed when the line editor starts up and
  1055.       the cursor is at the end of line.  Hitting an alphanumeric key (as
  1056.       opposed to a cursor key) as the first key will blank the original
  1057.       value which can be restored with <Esc>.  The $N input must be an
  1058.       integer and only integer input is accepted.
  1059.  
  1060.             In each case, the input string has a maximum length which may
  1061.       be larger than the edit window on screen.  If it is larger, the
  1062.       line editor with scroll horizontally if the cursor moves to the
  1063.       start or end of the edit window.
  1064.  
  1065.             The point is that the editor is quite intuitive and most
  1066.       users will have no trouble using it without explicit directions.
  1067.  
  1068.  
  1069.       I.9 BUSIC - a first look
  1070.  
  1071.             BATUTIL includes a full featured language which goes way beyond
  1072.       the DOS batch language.  We dub it BUSIC for BatUtil's Standard
  1073.       Instructions and Commands.  Despite the name it is closer to Pascal
  1074.       or C than BASIC.  While it can be used at the command line, the use
  1075.       of {}'s gets tedious and we recommend limiting BUSIC to INclude sets
  1076.       of commands.  Chapter VI is devoted to this language but we'll make a
  1077.       few general remarks here.
  1078.  
  1079.             There are 32 internal variables.  Two are special - $r is like
  1080.       the RC environmental variable and $% tracks the last fileIO error
  1081.       when IOerrors are trapped.  These two variables cannot be set with the
  1082.       set command but can be ECHOed with metastring translation or used in
  1083.       other places, e.g. inside a comparison after an IF, where they are
  1084.       read.
  1085.  
  1086.             You will most often use the internal variables $1,...,$0, ten in
  1087.       all.  In addition while they are more awkward to use there are an
  1088.       additional 20 variables which are indicated by $ followed by one of
  1089.       the ASCII codes 130-149, that is $é, $â, ..., $ò.  These can be set
  1090.  
  1091.  
  1092.       Chapter I:OVERVIEW                                         Page 20
  1093.  
  1094.  
  1095.  
  1096.  
  1097.                         Documentation for BATUTIL, Version 4.0
  1098.  
  1099.  
  1100.       with commands like
  1101.             SEt $1=....
  1102.       The set is actually optional for these 30 variables, that is
  1103.             $1=$Q
  1104.       is the same as
  1105.             SEt $1=$Q
  1106.       and would place up an edit box whose value is stored in $1.
  1107.  
  1108.             The commands
  1109.                 ++ $1
  1110.       and
  1111.                 -- $1
  1112.       (where $1 is any of the 30 internal variables that you can set) will
  1113.       check to see if $1 is number (if it is not there will be an error
  1114.       exit!) and if so increase or decrease it by one.  If the variable is
  1115.       empty, it is treated as if it were 0 for purposes of these commands.
  1116.  
  1117.             The keywords in the language cannot be abbreviated.  We'll
  1118.       usually capitalize them for emphasis but they are not case sensitive.
  1119.       After THEN or ELSE in an IF clause, after FOR, after a CASE option,
  1120.       and after a WHILE or REPEAT, you need to place a legitimate BATUTIL
  1121.       command, for example
  1122.             IF $1>6 THEN ECho it is greater than 6
  1123.       In all these cases you can replace the command by the single keyword
  1124.       begin and then place several commands each on a separate line (or
  1125.       separated by {}[]) with an END to indicate that you finished the set
  1126.       of commands started with a BEGIN.  For example to count the files in
  1127.       a directory starting with b, echoing their names to the screen, you
  1128.       could use:
  1129.             $1=0
  1130.             FOR $2 in (b*.*) DO BEGIN
  1131.               ++ $1
  1132.               ECho $1:$2$_
  1133.             END
  1134.       Our sample will indent commands between BEGIN/END pairs for
  1135.       readability but leading spaces are ignored by BUSIC.
  1136.  
  1137.             $R is a special metastring.  It will read from a text file -
  1138.       see Section VI.5 for discussion of reading from file and writing to
  1139.       them. If the file you read from is "con", then special handling is
  1140.       done and you read from the screen.  You can read from absolute screen
  1141.       positions or positions relative to the current one.
  1142.  
  1143.  
  1144.  
  1145.  
  1146.       Chapter I:OVERVIEW                                         Page 21
  1147.  
  1148.  
  1149.  
  1150.  
  1151.                         Documentation for BATUTIL, Version 4.0
  1152.  
  1153.  
  1154.             BATUTIL's TRace command is discussed in Section VI.12.  There is
  1155.       a powerful but dangerous option that allows you to directly read and
  1156.       write from/to memory and or a processor IO port.  Because we'd not
  1157.       want you to do this by accident, you must turn this mode on within
  1158.       EACH running of BATUTIL with a {HACKER +} command.  We discuss this
  1159.       in Section VI.13.
  1160.  
  1161.  
  1162.       I.10 String manipulation, arithmetic and date arithmetic
  1163.  
  1164.             BATUTIL include special metastrings to handle string
  1165.       manipulation and arithmetic.  $s (to be distinguished from $S=space)
  1166.       when translated manipulates a string.  The syntax is
  1167.             $s(X,string,Y)
  1168.       where S is a single letter key and Y are parameters which are special
  1169.       to each value of X.  For example
  1170.             $s(W,string,4)
  1171.       would become the fourth word in the string and
  1172.             $s(U,string)
  1173.       would make the string Uppercase. Section VI.2 describes this
  1174.       metastring in full details.
  1175.  
  1176.             $V (to be distinguished from $v=DOS version) does arithmetic.
  1177.       The syntax is to put an arithmetic string inside parenthesis
  1178.       following $V. For example
  1179.             $V(1+4)
  1180.       would translate to 5.  Only integer arithmetic is done.  Operations
  1181.       are summarized in Section VI.3.  Multiple parentheses are handled and
  1182.       there is metastring translation inside the (..) so that you can use
  1183.       $1, etc and environmental variables.  For example internally, BATUTIL
  1184.       translates ++$1 to
  1185.             SEt $1=$V($1+1)
  1186.  
  1187.             In Version 1.0 $E, $M, $D, $Y, $W referred to today in English,
  1188.       the month, day of month, year and weekday.  That remains true IF
  1189.       these are not followed by a (.  If they are BATUTIL will attempt to
  1190.       translate the argument into one of three formats
  1191.             1.  sees if it is number between 1 and 7305 and interprets it
  1192.                as a date between 1/1/80 and 12/31/99
  1193.             2.  sees if it has the format MM-DD-YY or MM/DD/YY and
  1194.                interprets it in that format as an American style date
  1195.             3.  looks for a filename with that name and interprets it as
  1196.                the date of that file.
  1197.       So, for example, if the file C:\dos\command.com has a date of
  1198.  
  1199.  
  1200.       Chapter I:OVERVIEW                                         Page 22
  1201.  
  1202.  
  1203.  
  1204.  
  1205.                         Documentation for BATUTIL, Version 4.0
  1206.  
  1207.  
  1208.       12/19/88, then all three of $E(12/19/88), $E(C:\dos\command.com) and
  1209.       $E(3276) would become December 19, 1988 after metastring
  1210.       translation. If the European date switch is turned on, then the date
  1211.       is interpreted as DD/MM/YY in place of MM/DD/YY.
  1212.  
  1213.             The use of number of days after 1/1/80 wouldn't be useful if
  1214.       you had to count the days yourself.  So there is a metastring $J
  1215.       which counts that number of days.  With no parameters, it is today
  1216.       and for example $J(12/19/88)=3276.  Thus for example, you could do
  1217.       date arithmetic with
  1218.             batutil {EC the date 200 days from today is $E($V(200+$J))}
  1219.  
  1220.  
  1221.       I.11 Control Break handling
  1222.  
  1223.             BATUTIL looks especially for the user to press ^Break.  If
  1224.       this is pressed during the running of BATUTIL, then the message
  1225.             ╒═══════════════════╕
  1226.             │ Quit BATUTIL(Y/N)?│
  1227.             ╘═══════════════════╛
  1228.       pops up.  If you answer yes, then BATUTIL pops up a message:
  1229.             ╒══════════════════════════╕
  1230.             │ Halt Batch file too(Y/N)?│
  1231.             ╘══════════════════════════╛
  1232.       With either response to this question, BATUTIL is then halted.  If
  1233.       you've also answered yes to the second question, then BATUTIL will
  1234.       turn DOS Break on and place a ^C buffer so the batch file should
  1235.       offer you the chance to terminate it.  If you prefer running with
  1236.       Break off, you'll need to do that by hand if you use this emergency
  1237.       exit.  This response is to ^Break only and NOT also to Ctrl-C.
  1238.  
  1239.             If you answer N to the initial "Quit BATUTIL" question, then
  1240.       BATUTIL will ask
  1241.             ╒════════════════════╕
  1242.             │ Turn TRACE On(Y/N)?│
  1243.             ╘════════════════════╛
  1244.       Either way BATUTIL will continue but if you answer yes to the TRACE
  1245.       On question then BATUTIL's single step debug mode is turned on but
  1246.       not until the currently executing command is finished.
  1247.  
  1248.             If you quit BATUTIL with ^Break but elect not to halt the
  1249.       batch file, BATUTIL exits with the errorlevel set to 255.
  1250.  
  1251.  
  1252.  
  1253.  
  1254.       Chapter I:OVERVIEW                                         Page 23
  1255.  
  1256.  
  1257.  
  1258.  
  1259.                         Documentation for BATUTIL, Version 4.0
  1260.  
  1261.  
  1262.             For third party batch files, you may want to turn off ^Break
  1263.       to prevent the user from breaking at an inconvenient point.  When
  1264.       BATUTIL loads, it checks to see if
  1265.             BU^=no
  1266.       is in the environment; if it is, then the ^-Break handler is not
  1267.       installed, so just include
  1268.             set BU^=no
  1269.       in the batch file to avoid this premature exit.
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.       Chapter I:OVERVIEW                                         Page 24
  1309.  
  1310.  
  1311.  
  1312.  
  1313.                    Chapter II:SYSTEM INFORMATION
  1314.  
  1315.       II.1 Overview
  1316.  
  1317.             You can use BATUTIL to query the system to get information
  1318.       about the current date and time, the current drive, hardware
  1319.       information like the number of monitors or printer ports, and file
  1320.       information like whether a particular file exists on the DOS path.
  1321.       Related are a primitive MAKE command which examines two files and
  1322.       tells you which is older and a RUN command which will tell you the
  1323.       errorlevel that a subsidiary program returns.  You can get the
  1324.       information stored in the special environment variable RC (and the
  1325.       internal variable $r) or in the errorlevel or both.  For example,
  1326.             batutil [HO]
  1327.       returns the current hour in the errorlevel while
  1328.             batutil {HO}
  1329.       returns it in both RC and the errorlevel.  Only the last {} command
  1330.       on the line has information returned in errorlevel.  If any []
  1331.       command is encountered then that is the last command that BATUTIL
  1332.       executes before exiting.  Except for the internal FDir command, all
  1333.       commands discussed in this chapter are dual mode []/{} commands.
  1334.  
  1335.             If an intermediate result is stored in an environmental
  1336.       variable like RC, you can have it placed in the errorlevel with the
  1337.       ERrorlevel command as in
  1338.             batutil {HO}{EC The current hour is $x(rc)}[ER $x(rc)]
  1339.       The $x syntax is discussed in Section III.1.
  1340.  
  1341.             Many commands come in pairs like #Disk and @Disk starting
  1342.       with # or @.  Typically, # refers to total and @ to free so that
  1343.             batutil [#D]
  1344.       places in the errorlevel the total space on the default drive and
  1345.             batutil [@D]
  1346.       the amount of free space.  As in STACKEY, the left round parenthesis,
  1347.       (, is a synonym for @ and the right round parenthesis, ), for #.  Thus
  1348.       the last command could also be
  1349.             batutil [(D]
  1350.  
  1351.             Commands have full names such as HOUR but any name can be
  1352.       abbreviated by using two or more letters as in HO or HOU.  To
  1353.       emphasize this, we'll write the commands as HOur but that does not
  1354.       mean you have to type the command with that capitalization.
  1355.       BATUTIL's command interpreter is not case sensitive.  When you want
  1356.       to squeeze a lot on the command line, you'll want to use the two
  1357.       letter abbreviation.
  1358.  
  1359.  
  1360.  
  1361.  
  1362.       Chapter II:SYSTEM INFORMATION                              Page 25
  1363.  
  1364.  
  1365.  
  1366.  
  1367.                         Documentation for BATUTIL, Version 4.0
  1368.  
  1369.  
  1370.             You'll often want to use the SEt command and metastring
  1371.       expansion in connection with or instead of the commands of this
  1372.       chapter.  The SEt command is described in Section V.3 and
  1373.       metastrings in Section III.1.  As examples of what we mean,
  1374.             batutil {#Comm}{SEt comm=$x(rc)}{#Prn}{SEt prn=$x(rc)}
  1375.       would place the number of comm ports in the environment as
  1376.             comm=nn
  1377.       and then the number of printers as
  1378.             prn=nn
  1379.       but one wouldn't use
  1380.             batutil {HO}{SEt hour=$x(rc)}
  1381.       since there is a metastring for the current hour and one could
  1382.       just as well use
  1383.             batutil {SEt hour=$H}
  1384.       Moreover, the $M, $D, $Y, $W metastrings take an argument while the
  1385.       MO, DA, YE and WE commands do not.
  1386.  
  1387.  
  1388.       II.2 Time
  1389.             Commands: HOur, MInute, WEekday, DAte, MOnth, YEar
  1390.  
  1391.             You can return information on the time and date in the
  1392.       errorlevel as follows
  1393.             HOur the hour in military time from 0 to 23
  1394.             MInute the number of minutes past the hour from 0 to 59
  1395.             WEekday the day of the week from 0=Sunday to 6=Saturday
  1396.             DAte the day of the month from 1 to 31
  1397.             MOnth the number of the month from 1 to 12
  1398.             YEar the number of years since 1980 from 0 to 19 so in 1988
  1399.       this would return 8.
  1400.  
  1401.  
  1402.       II.3 Operating System and Memory Information
  1403.             Commands: DOs, DRive, LIm, HImem, CArousel, DView, #Mem, @Mem,
  1404.       #Lim, @Lim, #Xtended, @Xtended, #Env, @Env, #Disk, @Disk
  1405.  
  1406.             Parameters: For #D and @D, no parameter picks default drive or
  1407.       you can give a drive letter.  For DOs, nothing, "4", "N", "S", "F",
  1408.       "B", "L", or "W".
  1409.  
  1410.             You can return the following information about the operating
  1411.       environment:
  1412.  
  1413.  
  1414.  
  1415.  
  1416.       Chapter II:SYSTEM INFORMATION                              Page 26
  1417.  
  1418.  
  1419.  
  1420.  
  1421.                         Documentation for BATUTIL, Version 4.0
  1422.  
  1423.  
  1424.             DOs returns the DOS Version times 10 rounded downwards so DOS
  1425.       2.1 would return 21 and DOS 3.21 would return 32.
  1426.  
  1427.             "DOs 4" returns information about the program 4DOS from JP
  1428.       Software, an alternative to Command.com.  If a swapping version of
  1429.       4DOS is loaded anywhere in memory, then the value 1 is returned;
  1430.       otherwise the value 0 is returned. This requires 4DOS Version 2.1 or
  1431.       later.
  1432.  
  1433.             "DOs N" is like "DOs 4" except it tests for NDOS from
  1434.       Symantec's Norton division.
  1435.  
  1436.             "DOs S" tests whether DOS' share program is loaded.  If it is
  1437.       the value returned is 1 and if it is not loaded, the value returned
  1438.       is 0.
  1439.  
  1440.            "DOs F" counts the number of DOS file handles in the system as
  1441.       set up in config.sys with additional handles set up with say QEMM's
  1442.       FILES program.  This is the number in the system, rather than the
  1443.       number still available or the number in use.
  1444.  
  1445.             "DOs B" counts the number of DOS buffers in the same way.
  1446.  
  1447.             "DOs L" returns the number of possible logical drives the
  1448.       system can have as determined by the DOS Lastdrive parameter.
  1449.  
  1450.             "DOs W" returns information about whether BATUTIL is running in
  1451.       a DOS partition set up by Microsoft Windows and returns the
  1452.       following:
  1453.             0 = Windows not running (or Windows 286 Versions prior to 3.0)
  1454.             1 = Windows 3.x running in real or standard mode
  1455.             2 = Windows 2.x /386 running
  1456.             3 = Windows 3.x running in enhanced mode
  1457.       Since documented calls are used, this should work with Windows 3.1
  1458.       when it is released.
  1459.  
  1460.             DRive returns the current drive with 0=A, 1=B, ...., 25=Z.
  1461.       This is the drive as DOS reports it so if SUBST is in effect, the
  1462.       subst letter will be used.
  1463.  
  1464.             LIm returns 0 if no EMS manager is installed and the Version
  1465.       times 10 rounded downwards so to check whether an EMS 4.0 driver is
  1466.       installed you'd use
  1467.             batutil [LI]
  1468.  
  1469.  
  1470.       Chapter II:SYSTEM INFORMATION                              Page 27
  1471.  
  1472.  
  1473.  
  1474.  
  1475.                         Documentation for BATUTIL, Version 4.0
  1476.  
  1477.  
  1478.             if errorlevel 40 .....
  1479.  
  1480.             HImem returns 0 if no XMS manager setting up the Microsoft
  1481.       Himem area is installed and a 1 if such a manager is installed.
  1482.       Examples of XMS managers are Himem, which comes with some Versions
  1483.       of Windows and DOS, 386Max and QEMM/386.
  1484.  
  1485.             CArousel returns 0 if SoftLogic's SOFTWARE CAROUSEL is not
  1486.       installed and otherwise returns the partition number from 1 to 12 (1 to
  1487.       10 with Carousel Versions prior to 3.0).
  1488.  
  1489.             DView returns 0 if Quarterdeck's DESQVIEW is not installed
  1490.       and otherwise returns the partition number from 1 to 255.
  1491.  
  1492.             OView has been dropped in this version.
  1493.  
  1494.             You can also get information about memory and disk resources:
  1495.  
  1496.             #Mem returns the total conventional memory in units of 4K
  1497.       from 0 to 160 (160 means 640K); the amount is rounded down.  If you
  1498.       have an appropriate program/hardware combination to have more than
  1499.       640K of conventional memory (EEMRAM, 386 to the max or QEMM, for
  1500.       example), then the number returned may be more than 640K but it
  1501.       will never be more than 184.
  1502.  
  1503.             @Mem returns the free conventional memory in units of 4K.
  1504.  
  1505.             #Lim returns 0 if no EMS memory is present; otherwise, it
  1506.       returns the total EMS memory in units of 64K from 0 to 199.  This
  1507.       is rounded down and with 12736K or more of EMS, 199 is returned.
  1508.  
  1509.             @Lim returns 0 if no EMS memory is present; otherwise, it
  1510.       returns the free EMS memory in units of 16K from 0 to 199.  This
  1511.       is rounded down and with 3184K or more of free EMS, 199 is
  1512.       returned.
  1513.  
  1514.             #Xtended returns 0 if no extended memory is present;
  1515.       otherwise, it returns the total extended memory in units of 64K
  1516.       from 0 to 199.  This is rounded down and with 12736K or more of
  1517.       extended memory, 199 is returned.
  1518.  
  1519.             @Xtended returns 0 if no extended memory is present;
  1520.       otherwise, it returns the "free" extended memory in units of 16K
  1521.       from 0 to 199.  This is rounded down and with 3184K or more of
  1522.  
  1523.  
  1524.       Chapter II:SYSTEM INFORMATION                              Page 28
  1525.  
  1526.  
  1527.  
  1528.  
  1529.                         Documentation for BATUTIL, Version 4.0
  1530.  
  1531.  
  1532.       extended memory, 199 is returned.  Because there is no standard
  1533.       for extended memory usage, BATUTIL is not totally accurate in its
  1534.       count of free extended memory.  It subtracts from the total
  1535.       available the amount used by VDISK and VDISK compatible programs.
  1536.  
  1537.             #Env returns the total amount of environment space in units
  1538.       of 16 bytes.  See Section V.1 for a discussion of the DOS
  1539.       environment area.  The answer can be from 0 to 199 with 199
  1540.       corresponding to 3184 or more bytes.
  1541.  
  1542.             @Env returns the free environment space in units of 1 byte.
  1543.       The answer can be from 0 to 199 with the later indicated 199 or
  1544.       more.
  1545.  
  1546.             #Disk returns the total amount of disk space.  An optional
  1547.       parameter is allowed of a letter.  If no parameter is given, then
  1548.       the response is for the default drive.  For drives A and B the
  1549.       errorlevel is space in units of 8K from 0 to 199 rounded down.  If
  1550.       there is more than 1592K, a value of 199 is returned.  For drives
  1551.       other than A, B the amount is in units of 256K from 0 to 199.  For
  1552.       drives of 49.75 Meg or more (possible only under DOS Versions greater
  1553.       than 3.30 or with special software), 199 is returned.  If an invalid
  1554.       drive letter is given, the errorlevel is set to 232.  If there is a
  1555.       syntax error such as asking for {#D 7}, the errorlevel is set to 208.
  1556.  
  1557.             @Disk returns the amount of free space on a disk drive with
  1558.       the same parameters and errorlevels for errors as #D.  For any
  1559.       drive, the amount free is reported in units of 8K from 0 to 199.
  1560.       With more than 1592K free, the value returned is 199.   Please note
  1561.       that @D and #D use different units.
  1562.  
  1563.  
  1564.       II.4 Console Information
  1565.             Commands: #Terminal, @Terminal, #Vmode, #Whichmon, #Altmon,
  1566.       @Ansi, #Keyboard, #Rodent
  1567.  
  1568.             Parameters: For #T, nothing, R, C or S
  1569.  
  1570.             BATUTIL will give you information about the system monitors
  1571.       and keyboards as follows:
  1572.  
  1573.             #Terminal with no parameter returns the number of monitors
  1574.       you have, either 1 or 2.  With the parameter R (or r or even Rows if
  1575.       you prefer), it returns the number of rows on the screen.  IBM EGAs
  1576.  
  1577.  
  1578.       Chapter II:SYSTEM INFORMATION                              Page 29
  1579.  
  1580.  
  1581.  
  1582.  
  1583.                         Documentation for BATUTIL, Version 4.0
  1584.  
  1585.  
  1586.       support 43 rows as well as 25 and VGAs support 50.  Many superVGAs
  1587.       support 33, 36 or 60 rows.  UltraVision also supports non-standard
  1588.       numbers of rows.  Similar UltraVision and some SuperEGA or SuperVGAs
  1589.       support 120 or 132 columns and #T with the C parameter returns the
  1590.       number of columns.  Some programs require 1 less than the number of
  1591.       rows so S, for Special as a parameter returns that.
  1592.  
  1593.             @Terminal returns the currently active monitor: 0 if mono and
  1594.       1 if color (or CGA compatible B/W like the old style Compaq
  1595.       monitors).
  1596.  
  1597.             #Vmode returns the current video mode as reported by int 10H.
  1598.  
  1599.             #Whichmon returns the type of the current monitor according
  1600.       to the following table:
  1601.                1 = monochrome  (old style MDA)
  1602.                2 = cga color
  1603.                4 = ega color
  1604.                5 = ega mono
  1605.                6 = professional graphics controller
  1606.                7 = vga mono
  1607.                8 = vga color
  1608.               11 = mcga mono
  1609.               12 = mcga color
  1610.               21 = hercules mono
  1611.               22 = hercules monochrome plus (with RAM font)
  1612.               23 = hercules Incolor
  1613.       If this ordering seems bizarre to you, it does to us also!  The
  1614.       numbers below 20 are taken from the official "Display Combination
  1615.       Code" in the IBM PS/2 computer BIOS and who are we to argue with
  1616.       IBM?
  1617.  
  1618.             #Altmon returns information about the second monitor if you
  1619.       have one.  Allowed values are 0 (which indicates no second
  1620.       monitor) and the numbers above.
  1621.  
  1622.             @Ansi returns 1 if an ANSI.SYS compatible console driver is
  1623.       installed and 0 otherwise.
  1624.  
  1625.             #Keyboard will return whether an "enhanced" keyboard is
  1626.       attached (the enhanced keyboard is the 101 key keyboard with the
  1627.       function keys across the top and the CapsLock where everyone knows
  1628.       the Ctrl key should be).  A 0 response indicates a 84 key keyboard
  1629.       and a 1 the enhanced keyboard.  Actually, BATUTIL is not testing
  1630.  
  1631.  
  1632.       Chapter II:SYSTEM INFORMATION                              Page 30
  1633.  
  1634.  
  1635.  
  1636.  
  1637.                         Documentation for BATUTIL, Version 4.0
  1638.  
  1639.  
  1640.       the keyboard but rather the presence of BIOS support for the
  1641.       enhanced keyboard.
  1642.  
  1643.             #Rodent returns 1 if a Microsoft compatible mouse is found and 0
  1644.       otherwise.
  1645.  
  1646.  
  1647.       II.5 Hardware Information
  1648.             Commands: #Intel, @Intel, #Prn, @Prn, #Comm, #Game, #Floppy,
  1649.       @Floppy
  1650.             Parameters: For @P, printer number from 1 to 3; no parameter
  1651.       picks LPT1.
  1652.  
  1653.             #Intel tests what CPU you have and reports as follows:
  1654.               0 = 8086/8088
  1655.               1 = 80186
  1656.               2 = 80286
  1657.               3 = 80386
  1658.               4 = 80486
  1659.              20 = NEC V20/V30
  1660.  
  1661.             @Intel tests what kind of math coprocessor that you have and
  1662.       reports as follows:
  1663.               0 = no math coprocessor
  1664.               1 = 8087
  1665.               2 = 80287
  1666.               3 = 80387
  1667.               4 = 80486 or 80486SX with 80487 installed
  1668.  
  1669.             #Prn reports the number of printers attached to your system
  1670.       (or more precisely the number that DOS thinks you have attached).
  1671.  
  1672.             @Prn returns error information for one of your printers.  You
  1673.       can specify a printer number or, if none is given, LPT1 will be
  1674.       tested.  The number returned means:
  1675.               0 = printer status OK
  1676.               1 = paper out error
  1677.               2 = I/O error
  1678.               3 = Timeout error
  1679.               4 = invalid printer
  1680.               5 = other printer error
  1681.       If you have a print spooler installed, you'll get a response of 0
  1682.       even if the printer is offline or out of paper.
  1683.  
  1684.  
  1685.  
  1686.       Chapter II:SYSTEM INFORMATION                              Page 31
  1687.  
  1688.  
  1689.  
  1690.  
  1691.                         Documentation for BATUTIL, Version 4.0
  1692.  
  1693.  
  1694.             #Comm returns the number of serial ports that you have; with
  1695.       more than 2 ports present, the method may not be reliable depending
  1696.       on how your non-DOS ports are added on.
  1697.  
  1698.             #Game returns the number of game ports that you have (or at
  1699.       least that BIOS thinks you have as stored in the equipment byte).
  1700.       Alas this number is often not accurate because not all game adapters
  1701.       are found by the BIOS.
  1702.  
  1703.             #Floppy returns the number of Diskette drives you have.
  1704.  
  1705.             @Floppy returns the following information
  1706.               0 = you have none or more than 1 diskette drive
  1707.               1 = you have a single diskette drive which is currently
  1708.       logical drive A
  1709.               2 = you have a single diskette drive which is currently
  1710.       logical drive B
  1711.  
  1712.  
  1713.       II.6 File Information
  1714.             Commands: EXist, CHeck, NUmberfiles
  1715.             Parameters: for EXist - filename (no wildcards)
  1716.                         for CHeck - pathname with or without trailing \
  1717.                         for NUmberfiles - filespec(s) with wildcards
  1718.             Internal Command: FDir
  1719.  
  1720.             BATUTIL has a number of commands that will return information
  1721.       about files on disk.  Each of these commands must have a parameter
  1722.       describing the filespec of the file or path you want information
  1723.       about.  They will only take a single parameter except for NUmberfiles.
  1724.  
  1725.             EXist is a more powerful version of DOS' "if exist" command.
  1726.       If a filename is given with no path or drive, the responses are
  1727.             0 = the file exists in the default directory or the filename
  1728.       is the name of a device loaded in your config.sys (see below)
  1729.             1 = the file does not exist in the current directory but it
  1730.       does exist somewhere on the PATH.  The directory can be returned in
  1731.       an environmental variable; see the discussion of FDir below.
  1732.             2 = the file does not exist in the path
  1733.             codes above 200 indicate DOS, syntax or environmental errors;
  1734.       see Chapter IX.
  1735.  
  1736.             If a path or drive is given as in "batutil {EX C:foobar.txt}"
  1737.       or "batutil {EX \bin\foobar.txt}", then the responses are
  1738.  
  1739.  
  1740.       Chapter II:SYSTEM INFORMATION                              Page 32
  1741.  
  1742.  
  1743.  
  1744.  
  1745.                         Documentation for BATUTIL, Version 4.0
  1746.  
  1747.  
  1748.             0 = the file exists in the specified drive and/or directory
  1749.             2 = the file does not exist in the specified drive and/or
  1750.       directory
  1751.             9 = the path given is not a valid path
  1752.             codes above 200 indicate DOS, syntax or environmental errors;
  1753.       see Chapter IX.
  1754.  
  1755.             EX does not interpret wildcards, that is if you look for a
  1756.       file named foo*.* as in "batutil {ex foo*.*}", then BATUTIL will
  1757.       look precisely for a file with that exact name and not find it.
  1758.  
  1759.             If a filename with no explicit path is entered as the
  1760.       parameter for EX and the file is not found in the current
  1761.       directory, then the DOS path is searched for it and optionally, the
  1762.       directory where it is found is placed in the environment.  By
  1763.       default, the name FDIR is used so that if foobar.txt existed in
  1764.       directory C:\bin which was in your path, then after running
  1765.             batutil {EX foobar.txt}
  1766.       RC would have the value 1 and FDIR the value C:\bin, that is a DOS
  1767.       SET (or batutil {ENvrep}) will include
  1768.             FDIR=C:\BIN
  1769.             RC=1
  1770.       The FDir command allows you to change where this directory name is
  1771.       stored.  If no new name is given then the directory name is not
  1772.       stored so
  1773.             batutil {FD}{EX foobar.txt}
  1774.       would not store the name C:\BIN anywhere while
  1775.             batutil {FD foo}{EX foobar.txt}
  1776.       would store the string
  1777.             FOO=C:\BIN
  1778.       You might want to use this directory name in a way that requires a
  1779.       backslash; for example you might want to copy the file.  Just
  1780.       adding the backslash by hand won't work if the directory is the
  1781.       root (which already ends in a backslash).  If you use FDIR to
  1782.       define a variable which begins with a \, then a trailing backslash
  1783.       is added.  Thus
  1784.             batutil {FD \foo}{EX foobar.txt}
  1785.       would store the string
  1786.             \FOO=C:\BIN\
  1787.       and you could then use the command
  1788.             copy %\foo%foobar.txt A:
  1789.       FDIR is also used by the $f file picklist discussed in Section V.5.
  1790.  
  1791.  
  1792.  
  1793.  
  1794.       Chapter II:SYSTEM INFORMATION                              Page 33
  1795.  
  1796.  
  1797.  
  1798.  
  1799.                         Documentation for BATUTIL, Version 4.0
  1800.  
  1801.  
  1802.             If your machine has a config.sys file, it likely loads
  1803.       various device drivers with the "device=" command.  In addition,
  1804.       DOS sets up various devices like NUL, CON, PRN and LPT2.  Some of
  1805.       the devices have explicit names.  For example, any EMS driver will
  1806.       call its device EMMXXXX0, the memory manager 386 to the Max calls
  1807.       its device 386MAX$$ and the Microsoft Himem program loads a device
  1808.       called XMSXXXX0.  If you use DOS' "if exist" it will recognize a
  1809.       device in any directory, so, for example
  1810.             if exist \somepath\nul echo hi
  1811.       will echo if and only if the directory \somepath\ exists.  In the
  1812.       same way, batutil {EX ...} will return a code of 0 if ... is a
  1813.       device.  But to distinguish devices from files, it does an extra
  1814.       check to see if the specified file is a device.  If it is, it sets
  1815.       FDIR (or whatever you've replaced fdir by with the FDIR command) to
  1816.       the value IS_A_DEVICE.
  1817.  
  1818.             CHeck will check whether a path exists and reply 0 if it does
  1819.       and 9 if it does not.  You can include a tailing backslash or not
  1820.       as you wish.
  1821.  
  1822.             If you want a batch file to act differently depending on
  1823.       whether A: has a diskette in it or not, use
  1824.             batutil Q {CH A:\}
  1825.       which will return errorlevel 0 if there is a diskette and
  1826.       errorlevel 230 (drive not ready) if not.  If you used
  1827.             if exist A:\nul
  1828.       instead and no diskette were there, the batch file would halt with
  1829.       an Abort, Retry, Fail message.
  1830.  
  1831.             NUmberfiles takes a filespec with wildcards and tells you how
  1832.       many files match in the default directory match that filespec, for
  1833.       example
  1834.             batutil {NU C:\bin\*.*}
  1835.       would tell you the total number of files in that directory.  The
  1836.       answer will be between 0 and 199; the answer 199 indicates that
  1837.       there are 199 or more matching files.  NU will take more than one
  1838.       file spec so that
  1839.             batutil {NU C:\bin\*.com C:\bin\*.exe}
  1840.       would tell you the total number of executables in C:\bin.
  1841.  
  1842.  
  1843.       II.7 The RUn Command
  1844.             Command: RUn, SKey
  1845.             Parameter: program name for RUn, Stackey strings for SKey
  1846.  
  1847.  
  1848.       Chapter II:SYSTEM INFORMATION                              Page 34
  1849.  
  1850.  
  1851.  
  1852.  
  1853.                         Documentation for BATUTIL, Version 4.0
  1854.  
  1855.  
  1856.             BATUTIL has a command that will let you run another program
  1857.       and get the errorlevel that program exits with recorded in the
  1858.       environment as the value of RC.  The syntax is
  1859.             batutil {RU programname}
  1860.       programname can include a path if you wish.  Like DOS, BATUTIL will
  1861.       ignore any extension that you give and first try a COM file and
  1862.       then an EXE file.  Afterward the program has run, RC will be set to
  1863.       the errorlevel of programname.  A typical application of this would
  1864.       be to get the errorlevel reported on screen by
  1865.             batutil {RU programname}{EC $x(RC)}
  1866.  
  1867.             For this purpose, a stand alone program called WHATEL is
  1868.       provided.  Just type in
  1869.             WHATEL programname
  1870.       and the program will report the errorlevel and the time it took
  1871.       programname to run.  This time is rounded up in units of 55
  1872.       milliseconds (the smallest unit of time one can measure without
  1873.       reprogammming the PC's internal clock) so that time differences of
  1874.       .06 seconds are insignificant.
  1875.  
  1876.             batutil {RU ...} will always swap to disk or EMS (see below)
  1877.       and leaves about 11K of memory for the stub or BATUTIL to reload
  1878.       after the RU command is done.  The disk space or EMS taken is about
  1879.       300K; WHATEL does not swap and takes less than 17K.
  1880.  
  1881.             There is a slight difference between how batutil {RU ...} and
  1882.       WHATEL work.  The former searches for a COM or EXE executable
  1883.       binary file in the current directory or on the path.  It will yield
  1884.       an error message if you use a batch file name, DOS internal command
  1885.       or bad command name.  You can always proceed the batch file name or
  1886.       internal command by
  1887.             command /c
  1888.       and the RUn command will run properly if command.com is on your path.
  1889.  
  1890.             Since WHATEL is also a timing utility, it might be used for
  1891.       batch files, internal commands or even to time a bad command.  So, if
  1892.       WHATEL cannot locate a suitable COM or EXE file, it passes your
  1893.       command to DOS to see if DOS can make sense if it.  In that case
  1894.       instead of reporting: "Errorlevel returned by ... was ..." WHATEL
  1895.       reports "...run from a shell of DOS".
  1896.  
  1897.             The RUn command will swap BATUTIL to EMS by default. Otherwise
  1898.       it will swap to the current directory.  The filename that it uses
  1899.       $$$$$$BU.SWP.  Any filename of this name will be replaced without
  1900.  
  1901.  
  1902.       Chapter II:SYSTEM INFORMATION                              Page 35
  1903.  
  1904.  
  1905.  
  1906.  
  1907.                         Documentation for BATUTIL, Version 4.0
  1908.  
  1909.  
  1910.       warning when the swap takes place and erased after the swap.  The
  1911.       swapfile is given the attributes Hidden and System.
  1912.  
  1913.             If the swap directory is a floppy disk or insufficient space
  1914.       is available on the swap drive and insufficient space is available
  1915.       in EMS, then BATUTIL will exit with errorlevel set to 238 and if
  1916.       verbose mode is on you'll get an error message 'RUN error: Swap file
  1917.       open error or bad path'.
  1918.  
  1919.             You can control where BATUTIL swaps to and if EMS is used with
  1920.       the environmental variable BUSWAP.  If
  1921.             BUSWAP=path
  1922.       then that path is used for the swap file.  For example if F: is a
  1923.       large ram disk, you might use
  1924.             BUSWAP=F:\
  1925.       If
  1926.             BUSWAP=-path
  1927.       with a minus sign in front of the path, then BATUTIL will force a
  1928.       disk swap and not use EMS.
  1929.  
  1930.             If you do not want BATUTIL to be swapped out at all (in which
  1931.       case BATUTIL continues to take about 300K of memory) just set BUSWAP
  1932.       to the value !, that is use
  1933.             set BUSWAP=!
  1934.  
  1935.             Three other errors that can occur when you try a RUn command
  1936.       are
  1937.             235: Program not found
  1938.             236: Insufficient memory to run program
  1939.             237: Misc. DOS error
  1940.  
  1941.             As with other cases where you shell from a program, you should
  1942.       be careful not to load any resident programs (TSRs) from a batch file
  1943.       executed with the RUn command.  If you do, you will likely crash when
  1944.       you attempt to return to BATUTIL.
  1945.  
  1946.             If STACKEY is loaded before BATUTIL, you can use the RUn
  1947.       command to first load keystrokes for a program you RUn from BATUTIL.
  1948.       But to avoid having to swap out BATUTIL twice, you can use BATUTIL to
  1949.       directly talk to STACKEY.  You use the SKey command followed by an
  1950.       appropriate STACKEY string.  Not all STACKEY commands are support but
  1951.       the following are - with STACKEY syntax:
  1952.             all ^ control combinations
  1953.             all 40 (shifted) function keys
  1954.  
  1955.  
  1956.       Chapter II:SYSTEM INFORMATION                              Page 36
  1957.  
  1958.  
  1959.  
  1960.  
  1961.                         Documentation for BATUTIL, Version 4.0
  1962.  
  1963.  
  1964.             the alt-key combos that start with @
  1965.             the cursor pad combos like UA
  1966.             ES, BS, TA, TB, ST, BT, CR, LF, FF, SP, SQ, DQ
  1967.             Xnnnn and #nnn single key input
  1968.             Wnnn waits
  1969.             ! buffer flush (only as a single command)
  1970.             strings in ".." or '..'
  1971.             $ metastrings as translated by BATUTIL except for
  1972.                 $X, $x, $L, $A, $a, $B, $C, $s,
  1973.                 $V ,$Q, $?, $N, $F, $f, $R, $Z, $z
  1974.             $E, $J, $M, $D, $J are supported for today but not with (..)
  1975.                 arguments
  1976.  
  1977.  
  1978.       II.8 TOdayfile and MAkefile
  1979.             Commands: TOdayfile, MAkefile
  1980.             Parameters: For TOdayfile: either a filename or an hour and
  1981.                              a filename; for MAkefile: two filenames
  1982.  
  1983.             The TOdayfile command is intended to tell you whether a given
  1984.       file has today's date.  As we'll explain in Chapter VII, it is
  1985.       intended for use in a batch file, usually an autoexec.bat file, to
  1986.       make sure that some operation is only done once a day.  In the
  1987.       simplest form, the syntax is
  1988.             batutil {TO filename}
  1989.       and the responses are
  1990.             0 = the file has today's date
  1991.             1 = the file exists and doesn't have today's date
  1992.             2 = file not found
  1993.             9 = invalid path
  1994.             above 200; DOS and syntax errors as in Chapter IX; allowed
  1995.       values are 230, 231  (for DOS error) or 204 - 207 (for syntax
  1996.       errors).
  1997.  
  1998.             If you wish, TO will take an optional numeric parameter as
  1999.       its first parameter, i.e. with syntax
  2000.             batutil {TO hour filename}
  2001.       where hour is between 0 and 23.  This parameter is used if you'd
  2002.       like the day to begin at a time other than midnight (0 is therefore
  2003.       a redundant choice put in only for completeness).  For example if
  2004.       you type in
  2005.             batutil {TO 5 test.dat}
  2006.       then BATUTIL will look at days beginning at 5 in the morning and
  2007.       see whether test.dat and the current date/time are on the same
  2008.  
  2009.  
  2010.       Chapter II:SYSTEM INFORMATION                              Page 37
  2011.  
  2012.  
  2013.  
  2014.  
  2015.                         Documentation for BATUTIL, Version 4.0
  2016.  
  2017.  
  2018.       "day".  Thus if test.dat was made yesterday at 8:15 AM the above
  2019.       command would return an errorlevel of 0 if the current time is
  2020.       before 5 AM and an errorlevel of 1 if after 5 AM.  This will
  2021.       prevent an action from happening if you stay up late at night and
  2022.       don't want to think of that as a new day.
  2023.  
  2024.             MAkefile requires two file names which we'll call file1 and
  2025.       file2.  The errorlevel returned is as follows:
  2026.             0 = file2 not found
  2027.             1 = file2 is strictly older
  2028.             2 = file1 not found
  2029.             3 = file1 older or the same age as file2
  2030.             9 = path not found
  2031.             above 200; DOS and syntax errors as in Chapter IX; allowed
  2032.                 values are 230, 231 (for DOS disk errors) and 204,205
  2033.                 (for syntax error)
  2034.       This choice is made because if file2 doesn't exist or is older, one
  2035.       will want to take an action like compile something or backup
  2036.       something else.
  2037.  
  2038.  
  2039.       II.9 The ERrorlevel Command
  2040.             Command: ERrorlevel
  2041.             Parameter: integer from 0 to 255
  2042.  
  2043.             You can set the errorlevel to a prescribed number between 0
  2044.       and 199 with the ERrorlevel command.  ER must be followed by a
  2045.       number or by a metastring beginning with $ that translate into a
  2046.       number or by $$ followed by a hex number.  If, after metastring
  2047.       translation, the parameter is not a number, BATUTIL exits with the
  2048.       errorlevel set to 206 (and an error message if Verbose mode is on).
  2049.       If the number is less than 0, 0 is returned and if greater than 199,
  2050.       then 199 is returned.
  2051.  
  2052.             For example
  2053.             batutil [ER $H]
  2054.       is the same as
  2055.             batutil [HO]
  2056.       and
  2057.             batutil ....[ER $r]
  2058.       would set the exit errorlevel to the value of RC set by an earlier
  2059.       command.
  2060.  
  2061.  
  2062.  
  2063.  
  2064.       Chapter II:SYSTEM INFORMATION                              Page 38
  2065.  
  2066.  
  2067.  
  2068.  
  2069.                    Chapter III: DISPLAY TOOLS
  2070.  
  2071.  
  2072.       III.1 Overview
  2073.  
  2074.             One of the most important aspects of a batch files on which
  2075.       DOS is woefully inadequate is communicating with the batch file
  2076.       user.  In this chapter, we'll discuss enhancements to better
  2077.       display messages giving you control on colors, on where the messages
  2078.       are displayed and allowing you easily place system information like
  2079.       the current drive in your messages.  BATUTIL also provides 10 sounds
  2080.       and 10 tunes with you can use to communicate with the batch file user.
  2081.       In the next chapter we'll discuss the tools that BATUTIL gives you to
  2082.       get input from the user.  One of those methods pops up a menu and
  2083.       another pops up a file list and so they also involve display.
  2084.  
  2085.             In Section III.2, we'll discuss some automatic translation
  2086.       that gets done when you ask BATUTIL to display a string.  This
  2087.       translation mechanism is also relevant to the SEt command discussed
  2088.       in Section V.3, when you write to a file (see Section VI.5) and, if
  2089.       you wish when you read from a file (also in Section VI.5).
  2090.  
  2091.             By default, BATUTIL displays by writing directly to the
  2092.       screen but as we'll discuss in Section III.9, you can instruct
  2093.       BATUTIL to use standard output if you wish to redirect the ECho
  2094.       command to a file or printer.
  2095.  
  2096.  
  2097.       III.2 Metastring Translation
  2098.             Commands: $Translate, ^Translate
  2099.             Parameters: - to turn off
  2100.             Metastrings: $$, $t, $d, $p, $v, $n, $g,$l, $b, $q, $h, $e, $_,
  2101.               $P, $T, $M, $D, $Y, $W, $E, $H, $m, $S, $^, $(, $), $`, $',
  2102.               $a, $A, $B, $C, $X, $x
  2103.  
  2104.             The DOS PROMPT command supports a set of what the DOS manual
  2105.       calls metastrings; something like $p is translated into the
  2106.       current path name.  STACKEY extended this set of metastrings.
  2107.       BATUTIL uses all the STACKEY metastrings and adds a few extra ones
  2108.       to accommodate its special structure.  This metastring translation
  2109.       takes place for the ECho and PRetty commands discussed in this
  2110.       chapter, the MEnu command of the next chapter, the SEt command of
  2111.       Chapter V, and the commands for reading and writing files.  As we'll
  2112.       explain, you can tell BATUTIL not to make the translation if you wish.
  2113.  
  2114.             Here are the PROMPT metastrings, all of which are used by
  2115.       BATUTIL:
  2116.  
  2117.  
  2118.       Chapter III: DISPLAY TOOLS                                 Page 39
  2119.  
  2120.  
  2121.  
  2122.  
  2123.                         Documentation for BATUTIL, Version 4.0
  2124.  
  2125.  
  2126.                $$              The character "$"
  2127.                $t              The time in HH:MM:SS.hh format
  2128.                $d              The date in DAY MM-DD-YYYY format
  2129.                                    e.g. Tue 9-30-1986
  2130.                                If European dates are set then the
  2131.                                    format is DAY DD/MM/YYYY
  2132.                $p              The current path in full, e.g. C:\BIN\FOO
  2133.                $v              The current DOS version
  2134.                $n              The current default drive
  2135.                $g              The character ">"
  2136.                $l              The character "<"
  2137.                $b              The character "|"
  2138.                $q              The character "="
  2139.                $h              The backspace
  2140.                $e              The ESCape
  2141.                $_              CR/LF (i.e. <Enter> followed by Ctrl-<Enter>
  2142.       and the special STACKEY metastrings which are used by BATUTIL:
  2143.                $P              same as $p in the root dir and as $p\ elsewhere
  2144.                $T              time in HHMM format
  2145.                $M              month in MM format, e.g. 09
  2146.                $D              day in DD format, e.g. 03
  2147.                $Y              year in YY format, e.g. 86 in 1986 and 99
  2148.       in 1999
  2149.                $W              day of the week in English, e.g. Sunday
  2150.                $E              the date in English, e.g. February 18, 1988
  2151.                                  or if European dates are set
  2152.                                  18 February 1988
  2153.                $H              hour from 00 to 23
  2154.                $m              minute from 0 to 59
  2155.       and BATUTIL will make the translation of ^ to indicate a control
  2156.       character, e.g. ^A and ^B will display happy faces.   $M, $D, $Y, $W
  2157.       and $E have BATUTIL extensions if immediately followed with no spaces
  2158.       by an argument in (..), for example $E(12/31/89).  If the argument is
  2159.       an integer between 1 and 7305, the argument is interpreted as the
  2160.       number of days after 12/31/79 (7305 is special because $E(7305) =
  2161.       December 31, 1999).  Otherwise, BATUTIL looks for a date in the
  2162.       format MM/DD/YY or MM-DD-YY with YY in the interval 80-99 or 1980-
  2163.       1999, MM in the interval 1-12 and DD in the interval 1-31 (if
  2164.       European dates are set, then DD/MM/YY is used rather than MM/DD/YY).
  2165.       So, for example, $W(11/23/89) = Thursday.  If the argument is neither
  2166.       an integer or a valid date, BATUTIL will try to interpret it as
  2167.       filename and if the file exists use its date as the basis for the
  2168.       translation. The number of days since 12/31/79 is important for date
  2169.       arithmetic so
  2170.  
  2171.  
  2172.       Chapter III: DISPLAY TOOLS                                 Page 40
  2173.  
  2174.  
  2175.  
  2176.  
  2177.                         Documentation for BATUTIL, Version 4.0
  2178.  
  2179.  
  2180.                $J              Julian calendar days from 12/31/79
  2181.       With no argument, $J is for today - otherwise it uses the same rules
  2182.       as #E, etc.  For example (with $V the eValuate metastring)
  2183.                $V($J(4/16/87)-$J(1/24/84))
  2184.       would be translated by BATUTIL to 1178, the number of days between
  2185.       April 16, 1987 and January 24, 1984.
  2186.  
  2187.             In addition, there are several metastrings special to
  2188.       BATUTIL starting with some simple translations:
  2189.                $S              a space
  2190.                $^              The character ^
  2191.                $(              The character {
  2192.                $)              The character }
  2193.                $`              The character [
  2194.                $'              The character ]
  2195.  
  2196.             The $S is necessary in situations where BATUTIL uses spaces
  2197.       to separate parameters and you want a space in a string.  For
  2198.       example
  2199.             batutil {ME a b c}
  2200.       would pop up a menu of the form
  2201.                                     ╒═══╕
  2202.                                     │ a │
  2203.                                     │ b │
  2204.                                     │ c │
  2205.                                     ╘═══╛
  2206.       while
  2207.             batutil {ME a$Sb c}
  2208.       would pop up a menu of the form
  2209.                                     ╒═════╕
  2210.                                     │ a b │
  2211.                                     │ c   │
  2212.                                     ╘═════╛
  2213.  
  2214.             $(, $), $` and $' are needed because {,},[,] are command
  2215.       separators for BATUTIL and their use in the middle of a display
  2216.       string would likely produce something other than what you want.
  2217.  
  2218.             BATUTIL will do filename parsing; if ... is a filename, then
  2219.               $a(...) = path of ... without trailing backslash
  2220.               $A(...) = path of ... with trailing backslash added
  2221.               $B(...) = name of ...
  2222.               $C(...) = extension of ....
  2223.       Note that these commands are case sensitive.  For example
  2224.  
  2225.  
  2226.       Chapter III: DISPLAY TOOLS                                 Page 41
  2227.  
  2228.  
  2229.  
  2230.  
  2231.                         Documentation for BATUTIL, Version 4.0
  2232.  
  2233.  
  2234.               $A(C:\bin\batfiles\foobar.bat) = C:\bin\batfiles\
  2235.               $a(C:\bin\batfiles\foobar.bat) = C:\bin\batfiles
  2236.               $B(C:\bin\batfiles\foobar.bat) = foobar
  2237.               $C(C:\bin\batfiles\foobar.bat) = bat
  2238.       Metastring translation is not done on the string in ... with one
  2239.       crucial exception.  The $x/$X environmental substitution is made.  The
  2240.       most common use of these filename parsers would be to use the $f
  2241.       command to have the user choose a file from a popup list which you
  2242.       could then parse, e.g.
  2243.             batutil {EC Pick file}{SEt foo=$f fooext=$C($x(foo))}
  2244.  
  2245.             You can access environmental variables with either $x(var) or
  2246.       $X(var) where "var" is the name of an environment variable.  $X
  2247.       will first translate the string using metastring translation while
  2248.       $x will not.  Thus if your environment includes
  2249.                FOO=$p
  2250.       the DOS level command
  2251.             batutil {EC $x(foo)}
  2252.       would display the string $p on the screen while
  2253.             batutil {EC $X(foo)}
  2254.       would display the current directory.  You can have a $x or $X as
  2255.       part of the variable being translated by $X in which case there is
  2256.       recursion.  To avoid a crash if an infinite loop results as it
  2257.       would if foo1=$X(foo2) and foo2=$X(foo1), $X's are only translated
  2258.       60 times at which point no further translation is done. When
  2259.       preparing batch files for third parties, use caution with $X.  If
  2260.       there is a metastring syntax error (like using $j, an improper
  2261.       metastring) in foo, then use of $X(foo) will cause BATUTIL to exit
  2262.       with error 209.
  2263.  
  2264.             There are two subtle differences between the $x command and using
  2265.       DOS' %...% command.  There is no effective difference between
  2266.             batutil {EC $x(foo)}
  2267.       and
  2268.             batutil {EC %foo%}
  2269.       but if your environment starts out with
  2270.                FOO=initial
  2271.       then
  2272.             batutil {SEt foo=final}{EC $x(foo)}
  2273.       would display "final" on the screen while
  2274.             batutil {SEt foo=final}{EC %foo%}
  2275.       would display "initial" on the screen.  In addition, DOS does the
  2276.       translation of %foo% before passing the command onto BATUTIL which
  2277.       could bring the command line above the maximum 127 characters
  2278.  
  2279.  
  2280.       Chapter III: DISPLAY TOOLS                                 Page 42
  2281.  
  2282.  
  2283.  
  2284.  
  2285.                         Documentation for BATUTIL, Version 4.0
  2286.  
  2287.  
  2288.       supported by DOS while BATUTIL only expands $x(foo) after getting
  2289.       the command line and there is not the same limitation.
  2290.  
  2291.             In the SEt command, $Q, $?, $¿, $N and $f have special meaning;
  2292.       see the discussion Sections V.4 and V.5.   In connection with the
  2293.       {GEtkey WAit} command, $L sets the location of a time countdown if
  2294.       used in an ECho or PRetty command.  See the discussion in Section
  2295.       IV.5
  2296.  
  2297.             BATUTIL's 32 internal variables are indicated with $-
  2298.       metastrings and are discussed in Section VI.1.  $R is used for reading
  2299.       from a file and is discussed in Section  VI.5.  $s is for string
  2300.       manipulation and $V for arithmetic - they are discussed in Sections
  2301.       VI.2 and VI.3.  $Z and $z are part of hacker mode discussed in
  2302.       Section VI.13.
  2303.  
  2304.             The supermetastring $!(...) is discussed in Section I.5.
  2305.  
  2306.             If you wish to turn off metastring translation, you can with
  2307.       the commands
  2308.             $T -    to turn off $ translation
  2309.             $T      to turn $ translation back on
  2310.             ^T -    to turn off ^ translation
  2311.             ^T      to turn ^ translation back on
  2312.       It is important to bear in mind that BATUTIL has no memory from one
  2313.       running to the next so that
  2314.             batutil {$T -}{EC $p}{$T}{EC $q$p}
  2315.       would display
  2316.                 $p=C:\BIN
  2317.       if BIN were your current directory but
  2318.             batutil {$T -}
  2319.             batutil {EC $p}{$T}{EC $q$p}
  2320.       would display
  2321.                 C:\BIN=C:\BIN
  2322.  
  2323.  
  2324.       III.3 BATUTIL's ECho Command
  2325.             Commands: ECho, ATtribute, MNattribute, CLs, EOline, ECHOLN
  2326.             Parameters: EC takes the string to echo
  2327.                        AT, MN take a hex byte.  AT T is also legal; see
  2328.                              Section IV.5
  2329.                        EOline takes an optional parameter of +
  2330.  
  2331.  
  2332.  
  2333.  
  2334.       Chapter III: DISPLAY TOOLS                                 Page 43
  2335.  
  2336.  
  2337.  
  2338.  
  2339.                         Documentation for BATUTIL, Version 4.0
  2340.  
  2341.  
  2342.             You can echo a string to the screen with the FEcho command
  2343.       discussed in Section III.5 below or with
  2344.                batutil {EC string}
  2345.       The reasons to use BATUTIL's echo rather than DOS' echo are the
  2346.       following
  2347.             -  metastring translation takes place with BATUTIL
  2348.             -  there is not an automatic CR (which means you'll need to
  2349.       remember to add $_) but you can place several lines of text on one
  2350.       echo line (subject to DOS' 127 character limitation) by using $_. Use
  2351.       ECHOLN to add an automatic CR.
  2352.             -  if you use BATUTIL's ECho command between two cursor
  2353.       location commands, BATUTIL will only be loaded once while if you
  2354.       use DOS' echo it will not
  2355.             -  as we'll explain, BATUTIL gives you color control
  2356.  
  2357.             BATUTIL stores away two color combinations that it uses: one
  2358.       for color screens which defaults to yellow on blue and one for
  2359.       monochrome screens which defaults to dull foreground (attribute
  2360.       07 hex).  This attribute is used in several places:
  2361.             it is used by the ECho command
  2362.             it is used to set the colors by the CLs command
  2363.             it is used for shadows in the MEnu command (Section IV.2)
  2364.             it is used to determine the attributes in the input box
  2365.                for the $? query command (Section V.4)
  2366.       You can change the attributes used with the ATtribute and
  2367.       MNattribute commands.  Each takes a hex byte either in the form 1A
  2368.       or $1A.  The color values are those which are popped up in CTRLALT
  2369.       PLUS' ^@R or CTRLALT's ^@T table.  The first digit is the
  2370.       background and the second foreground with the following rules
  2371.                            Background              Foreground
  2372.                    0       Black                   Black
  2373.                    1       Blue                    Blue
  2374.                    2       Green                   Green
  2375.                    3       Cyan                    Cyan
  2376.                    4       Red                     Red
  2377.                    5       Magenta                 Magenta
  2378.                    6       Brown                   Brown
  2379.                    7       Grey                    Grey
  2380.                    8       Black+Blinking          Dark Grey
  2381.                    9       Blue+Blinking           Light Blue
  2382.                    A       Green+Blinking          Light Green
  2383.                    B       Cyan+Blinking           Light Cyan
  2384.                    C       Red+Blinking            Light Red
  2385.                    D       Magenta+Blinking        Light Magenta
  2386.  
  2387.  
  2388.       Chapter III: DISPLAY TOOLS                                 Page 44
  2389.  
  2390.  
  2391.  
  2392.  
  2393.                         Documentation for BATUTIL, Version 4.0
  2394.  
  2395.  
  2396.                    E       Brown+Blinking          Yellow
  2397.                    F       Grey+Blinking           White
  2398.       where "blinking" refers to the foreground and should be used
  2399.       sparingly.  For example, AT=$AF would set the attribute to blinking
  2400.       white on green (ugh!).  For the hex digits a-f, you may use upper
  2401.       or lower case.
  2402.  
  2403.             Two attributes are special: $55 and $66.  $55 tells BATUTIL
  2404.       to use the attributes at the cursor position at the time the string
  2405.       writing begins as the attributes for the entire string.  $66 tells
  2406.       BATUTIL to write without changing any attributes.  These two are
  2407.       the same if the block to be written to has uniform attributes but
  2408.       different if they the attributes change as the block is traversed.
  2409.  
  2410.             CLs clears the screen in the current ATtribute or
  2411.       MNattribute and sets the cursor to the upper left.  Here is an
  2412.       example using the ROw and COlumn commands discussed below:
  2413.             batutil {CL}{AT=4F}{RO=15}{CO=5}{EC Hi! there}
  2414.       which would clear the screen in the default attributes of yellow on
  2415.       blue and then display "Hi! there" in white on red starting at row
  2416.       15, column 5.
  2417.  
  2418.             EOline, short for "End of Line" will erase the current line
  2419.       from the cursor position until the end of the line in the current
  2420.       attributes.  If you use a parameter of + as in
  2421.             batutil {EO +}
  2422.       then the entire line is erased.
  2423.  
  2424.             BATUTIL strips leading and tailing blanks from the string
  2425.       following EC so that {EC   hi   } is the same as {EC hi}.  If you
  2426.       actually want the leading or tailing blanks, you'll need to use $S
  2427.       as in {EC $S hi  $S}.  Note that the blanks between the first/final
  2428.       $S and "hi" are not stripped.
  2429.  
  2430.  
  2431.       III.4 The BOx Command
  2432.             Command: BOx
  2433.             Parameters: top bottom left right [frame movecur]
  2434.  
  2435.             You can display a box with or without frame with a single
  2436.       BATUTIL command.  The BOx command has four required parameters and
  2437.       two optional ones.  The four required parameters specify the top and
  2438.       bottom row and the left and right columns.  That is the upper left
  2439.       corner is at coordinates x=left, y=top and the lower right at
  2440.  
  2441.  
  2442.       Chapter III: DISPLAY TOOLS                                 Page 45
  2443.  
  2444.  
  2445.  
  2446.  
  2447.                         Documentation for BATUTIL, Version 4.0
  2448.  
  2449.  
  2450.       x=right, y=bottom.
  2451.  
  2452.             Normally, bottom must be at least two more than top and right
  2453.       at least two more than left of BATUTIL will exit with an error but if
  2454.       top=bottom (resp. left=right), then the box is centered vertically
  2455.       (resp. horizontally) and the height (resp. width) is the common
  2456.       value.  Metastring translation is done on these four parameters.
  2457.  
  2458.             The color attribute used for the box including frame is the one
  2459.       set by the ATtribute command of MNattribute commands.  By default,
  2460.       the frame is a single line but you can use an optional fifth
  2461.       parameter which is a number from 0 to 5.  The value 0 means no frame
  2462.       and 1-5 mean (with 1 the default)
  2463.  
  2464.                 ┌──┐         ╔══╗        ╒══╕       ╓──╖       +--+
  2465.             1:  │  │      2: ║  ║     3: │  │    4: ║  ║    5: |  |
  2466.                 └──┘         ╚══╝        ╘══╛       ╙──╜       +--+
  2467.  
  2468.             Notice that 1 and 2 have one and two lines all around, 3 more
  2469.       lines horizontal than vertical just like the numeral and similarly for
  2470.       4.
  2471.  
  2472.             By default, after the box is drawn, the cursor moves to the
  2473.       position on the inside upper left ready for writing text.  If you
  2474.       don't want the cursor to move use the parameter N in the fifth or
  2475.       sixth place.
  2476.  
  2477.             If you use the {SH +} command, then the box will display a
  2478.       shadow one character wide.  The attribute used is black by default
  2479.       but the attribute used is the value of the internal variable $8 (be
  2480.       sure to set it to 0 or the empty string if you've used it earlier!)
  2481.       which we discuss the setting of in Section VI.1.  If the attribute is
  2482.       XY, then attribute Y is used for the right and top half of the bottom
  2483.       shadow and X is used for the lower half of the bottom shadow.
  2484.  
  2485.  
  2486.       III.5 The PRetty Command
  2487.             Command: PRetty
  2488.             Parameters: string to display with @<Hex> for attribute change
  2489.  
  2490.             With the ECho command, you can display strings in multiple
  2491.       colors but it is rather tedious to have to write:
  2492.             batutil {AT 4F}{EC H}{AT 4E}{EC ello} to display Hello with
  2493.       the H in white on read and the rest in yellow on red.  The PRetty
  2494.  
  2495.  
  2496.       Chapter III: DISPLAY TOOLS                                 Page 46
  2497.  
  2498.  
  2499.  
  2500.  
  2501.                         Documentation for BATUTIL, Version 4.0
  2502.  
  2503.  
  2504.       command lets you use the @ sign to signal a color change.  If the @
  2505.       sign is followed by two hex digits (or a $ and two hex digits),
  2506.       then the string following it will be displayed in that color until
  2507.       the next @ sign.  So the above command line could be replace by
  2508.             batutil {PR @4FH@4Eello}
  2509.  
  2510.             Until you specify a new attribute with an @ command, PR will
  2511.       use the attributes set with the AT and MN commands (or their
  2512.       defaults 1E and 07).  Irrespective of what you do with @ commands,
  2513.       when you complete a PR command (i.e. the closing } occurs), the
  2514.       value of AT and MN that were in place before will be in effect, for
  2515.       example
  2516.             batutil {AT 4E}{PR @20 hi$S}{EC there}
  2517.       will display "hi " in black on green (attribute 20) but then
  2518.       "there" in yellow on red (attribute 4E).
  2519.  
  2520.             As for the AT and MN commands, the HEX digits following @ can
  2521.       have a-f upper or lower case and an optional $ after the @ is
  2522.       allowed.
  2523.  
  2524.  
  2525.       III.6 Bigecho
  2526.             Commands: BEcho, BPretty, BIgchar
  2527.             Parameters: for BEcho: string to echo with special meanings
  2528.       for leading or trailing ~ or a trailing ^
  2529.                    for BPretty: string with PRetty @ commands; special
  2530.       meaning to trailing ^
  2531.                    for BIgchar: a foreground character and optional second
  2532.       background character.  Each can be a character or a number from 1
  2533.       to 255 (255 has special meaning).
  2534.  
  2535.             BIGECHO is a free program from Ctrlalt Associates available
  2536.       on many bulletin boards.  As its name implies, it echoes large
  2537.       characters to the screen.  One font is 8 characters high and 8 wide
  2538.       and uses the built in CGA character set found in ROM.  There are
  2539.       additional smaller sets based on publicly available EGA fonts.
  2540.       BATUTIL includes a BIgecho command which uses the builtin 8x8 font.
  2541.       That is, messages displayed with it are eight lines (except for
  2542.       letters like j and g, the eighth line is blank) and are eight
  2543.       characters wide which means that up to 10 characters can be
  2544.       displayed on a line.
  2545.  
  2546.             The simplest command is BEcho which followed by a string
  2547.       displays that string in the large characters.  The current
  2548.  
  2549.  
  2550.       Chapter III: DISPLAY TOOLS                                 Page 47
  2551.  
  2552.  
  2553.  
  2554.  
  2555.                         Documentation for BATUTIL, Version 4.0
  2556.  
  2557.  
  2558.       attribute set with AT (or MN) is used.  Any characters that don't
  2559.       fit on the line will be truncated (this may be fewer than 10
  2560.       characters if you don't start with the cursor in column 1).  At the
  2561.       end of the line a "big carriage return" is issued, i.e. the cursor
  2562.       is moved to the first column of the row below the big characters.
  2563.       As we'll explain below, a leading ~ or trailing ^ or ~ will be
  2564.       suppressed and special actions will take place.
  2565.  
  2566.             Each character is stored as a set of dot patterns with the on
  2567.       dots normally displayed as the "foreground" color and the off dots
  2568.       as the "background color".  Thus the letter R is stored as the dot
  2569.       pattern (1 = on, 0 = off)
  2570.             11111100                            $$$$$$
  2571.             01100110                             $$  $$
  2572.             01100110                             $$  $$
  2573.             01111100        corresponding to     $$$$$
  2574.             01101100                             $$ $$
  2575.             01100110                             $$  $$
  2576.             11100110                            $$$  $$
  2577.       By default, BATUTIL, when BEchoing will replace each off dot by a
  2578.       space (character 32 in the ASCII scheme) and each on dot by the
  2579.       solid block (ASCII 219) so that R becomes
  2580.                                 ██████
  2581.                                  ██  ██
  2582.                                  ██  ██
  2583.                                  █████
  2584.                                  ██ ██
  2585.                                  ██  ██
  2586.                                 ███  ██
  2587.       However, you can replace these two characters by any pair of
  2588.       characters using the BIgchar command.  This command takes one or
  2589.       two parameters.  The first parameter specifies the character used
  2590.       for "on" dots while the second, which is optional, the character
  2591.       for off dots.  If the second parameter is absent, the off character
  2592.       is left unchanged from what it was (or from the default space if
  2593.       you haven't changed it).  The parameters can be either a single
  2594.       ASCII character or a number from 01 to 255.  To distinguish a
  2595.       number less than 10 from the corresponding ASCII character, place a
  2596.       0 in front of the number.  Thus {BI 1} will use "1" for the on
  2597.       character while {BI 01} will use a happy face (ASCII 1).  Hex
  2598.       digits if proceeded with a $ are also allowed (e.g. $20 in place of
  2599.       32). For example, to show the pattern
  2600.                                      ╬╬
  2601.                                ╬  ╬╬  ╬
  2602.  
  2603.  
  2604.       Chapter III: DISPLAY TOOLS                                 Page 48
  2605.  
  2606.  
  2607.  
  2608.  
  2609.                         Documentation for BATUTIL, Version 4.0
  2610.  
  2611.  
  2612.                                ╬  ╬╬  ╬
  2613.                                ╬     ╬╬
  2614.                                ╬  ╬  ╬╬
  2615.                                ╬  ╬╬  ╬
  2616.                                   ╬╬  ╬
  2617.                                ╬╬╬╬╬╬╬╬
  2618.  
  2619.       you'd want to use {BI 32 ╬} or {BI 32 206} or {BI $20 $CE}.  Use of
  2620.       the on character 255 is special.  It is interpreted to use the
  2621.       character itself for the on character (and space for the off
  2622.       character) so
  2623.             batutil {BI 255}{BE Hi there}
  2624.       would yield
  2625.             HH  HH    ii               t    hhh
  2626.             HH  HH                    tt     hh
  2627.             HH  HH   iii             ttttt   hh hh   eeee   rr rrr   eeee
  2628.             HHHHHH    ii              tt     hhh hh ee  ee   rrr rr ee  ee
  2629.             HH  HH    ii              tt     hh  hh eeeeee   rr  rr eeeeee
  2630.             HH  HH    ii              tt t   hh  hh ee       rr     ee
  2631.             HH  HH   iiii              tt   hhh  hh  eeee   rrrr     eeee
  2632.  
  2633.             Metastring translation takes place for the BEchoed string.
  2634.       You'll use this mainly for $S spaces at the start (although it may
  2635.       be more useful to use the CO command to adjust the column of the
  2636.       cursor).  If you do not want the big CR which is issued by default,
  2637.       end the string with a ^.  The cursor is then left on the initial
  2638.       row in the column where the next large character would have
  2639.       appeared.  Thus
  2640.             batutil {BI 255}{BE B^}{BI 219}{BE at}
  2641.       would yield
  2642.             BBBBBB             █
  2643.              BB  BB           ██
  2644.              BB  BB  ████    █████
  2645.              BBBBB      ██    ██
  2646.              BB  BB  █████    ██
  2647.              BB  BB ██  ██    ██ █
  2648.             BBBBBB   ███ ██    ██
  2649.  
  2650.             If you have an off character other than the default space,
  2651.       BATUTIL assumes that you want the entire line to covered with that
  2652.       character except where the foreground appears (try
  2653.             batutil {BI 32 206}{CO 9}{BE Hi there}
  2654.       to see what we mean).  If you don't want this effect, add ~ both
  2655.       before and after the string as in {BE ~Hi there~}.  A ~ at the
  2656.  
  2657.  
  2658.       Chapter III: DISPLAY TOOLS                                 Page 49
  2659.  
  2660.  
  2661.  
  2662.  
  2663.                         Documentation for BATUTIL, Version 4.0
  2664.  
  2665.  
  2666.       start of the only will not fill in the space before the string.
  2667.       When a non-space off character is used, a ^ at the end and a ~ at
  2668.       the beginning also suppresses filling in spaces after the string.
  2669.  
  2670.             BPretty is like BEcho with the following changes:
  2671.               - as with Pretty, you can use @ followed by a hex attribute
  2672.       to change colors
  2673.               - off character fillin as described above for BEcho does
  2674.       not take place so leading and trailing ~ characters have no effect (but
  2675.       are stripped off).
  2676.  
  2677.             You cannot redirect BEcho or BPretty to STDOUT (i.e. {ST +}
  2678.       will be ignored by these commands).
  2679.  
  2680.  
  2681.       III.7 Getting Echo/Pretty Input from a File
  2682.             Commands: FEcho, FPretty
  2683.             Parameters: filename, optional label as second parameter
  2684.  
  2685.             If you have several lines to display, using the ECho or PRetty
  2686.       commands can be a nuisance.  You'll have to prepare several BATUTIL
  2687.       lines in your batch file.  For convenience, there are the FEcho and
  2688.       FPretty commands which take input for ECho and PRetty from a file.
  2689.       Rules for finding the filename (your path is searched) and the use of
  2690.       labels are discussed in Section I.5.
  2691.  
  2692.             Lines are read in from the file and processed as they would
  2693.       be by the ECho or PRetty command with two exceptions:
  2694.             -  leading and trailing blanks are not striped off - that is
  2695.       lines will display as they appear.
  2696.             -  each new line in the file causes a new line on the display
  2697.       except that there is not a new line command issued for the last line
  2698.       displayed (unless it ends in a $_).  In particular, blank lines in
  2699.       the file display as blank lines on the screen.
  2700.  
  2701.             Unless turned off with the $T - command, full metastring
  2702.       translation takes place and @ color changes are done by FPretty.
  2703.  
  2704.  
  2705.       III.8 Cursor Position and Hiding the Cursor
  2706.             Commands: ROw, COl, CUrsor
  2707.             Parameter:   RO takes a number from 1 to 25; may begin with +
  2708.                              or -.  A T is also legal; see Section IV.5
  2709.                          CO takes a number from 1 to 80; may begin with +
  2710.  
  2711.  
  2712.       Chapter III: DISPLAY TOOLS                                 Page 50
  2713.  
  2714.  
  2715.  
  2716.  
  2717.                         Documentation for BATUTIL, Version 4.0
  2718.  
  2719.  
  2720.                              or -.  A T is also legal; see Section IV.5
  2721.                          CU takes + or -
  2722.  
  2723.             If you want a screen in a batch file to begin with 10 blank
  2724.       lines under DOS, you've got to have 10 lines with
  2725.             echo <char 255>
  2726.       (where <char 255> is the ASCII 255 character) or something similar.
  2727.       BATUTIL allows you to control cursor position.  {ROw n} where n
  2728.       runs from 1 to 25 sends the cursor to row n and similar {COl n} to
  2729.       column n.
  2730.  
  2731.             If just a number is listed after RO or CO, then the
  2732.       coordinates are absolute but if you precede then with a + or -,
  2733.       then the coordinates are relative.  For example
  2734.             batutil {RO 5}{CO 5}{EC hi}{RO -3}{CO +3}{EC there}
  2735.       would print "hi" on row 5, col 5 and then "there" on row 2, column
  2736.       10 (since writing "hi" move the cursor to column 7).
  2737.  
  2738.             BATUTIL will not wrap to the next line with relative
  2739.       coordinates and it will stop at the right or left edge if a
  2740.       relative coordinate shift would take it off the screen.  The same
  2741.       is true of the top.  However, if a relative row shift would take
  2742.       it below the bottom edge, it will scroll the screen.
  2743.  
  2744.             It is often more elegant if the cursor is hidden when you are
  2745.       displaying a message on the screen.  {CUrsor -} will hide the
  2746.       cursor while {CUrsor +} will restore it to normal shape.  When
  2747.       BATUTIL finishes running, the cursor is automatically restored so
  2748.       you'll only need {CU +} if you want the cursor to reappear in the
  2749.       middle of a sequence of commands.  Places where you'd normally want
  2750.       BATUTIL to show a cursor like $Q in a set command, BATUTIL will
  2751.       show a cursor even if {CU -} is in effect so you'll only use {CU +}
  2752.       rarely.
  2753.  
  2754.  
  2755.       III.9 The STdout Command
  2756.             Command: STdout
  2757.             Parameter: + or -
  2758.  
  2759.             DOS' echo command is sent to standard output while, by
  2760.       default, BATUTIL will write directly to the screen.  If you want EC
  2761.       to go to standard output, use {STdout +}.  To turn off this use
  2762.       {STdout -}.
  2763.  
  2764.  
  2765.  
  2766.       Chapter III: DISPLAY TOOLS                                 Page 51
  2767.  
  2768.  
  2769.  
  2770.  
  2771.                         Documentation for BATUTIL, Version 4.0
  2772.  
  2773.  
  2774.             You would use {ST +} (the + is not necessary) if you wanted
  2775.       to redirect the output of the EC command (or of the messages from
  2776.       the SA, LO or KI commands) to a file or to NUL.
  2777.  
  2778.             To make a beep in the middle of a BATUTIL sequence, redirect
  2779.       output to STDOUT and echo a ^G as in
  2780.             batutil {ST}{EC ^G}{ST -}{EC You dummy!!!}
  2781.  
  2782.             If you echo to the screen with ST in effect, color commands have
  2783.       no effect.
  2784.  
  2785.  
  2786.       III.10 Sounds
  2787.             Command: SOund, NSound
  2788.             Parameter: SOund takes a single required number from 1 to 20
  2789.                 and an optional second number
  2790.                        NSound takes a - or an optional +
  2791.  
  2792.             BATUTIL comes with ten brief sounds and ten tunes - the ten
  2793.       tunes were made with PIANOMAN.  Each has a number; the ten sounds:
  2794.             1:ping
  2795.             2:wolf whistle
  2796.             3:random electronic sound (needs a repeat to sound much)
  2797.             4:short buzz
  2798.             5:tweet
  2799.             6:alarm clock ring
  2800.             7:buzzer
  2801.             8:electronic sound 1
  2802.             9:electronic sound 2
  2803.            10:train with Doppler effect
  2804.  
  2805.       while the tunes are fragments from:
  2806.            11:Dance of the Clowns
  2807.            12:Habana from Carmen
  2808.            13:Sailor's Hornpipe
  2809.            14:Mapleleaf Rag
  2810.            15:Land of Hope and Glory (Pomp and Circumstance)
  2811.            16:Porky Pig Theme ("That's All Folks")
  2812.            17:Pop Goes the Weasel
  2813.            18:William Tell Overture (Lone Ranger's Theme), part I
  2814.            19:William Tell Overture (Lone Ranger's Theme), part II
  2815.            20:Yellow Rose of Texas
  2816.  
  2817.  
  2818.  
  2819.  
  2820.       Chapter III: DISPLAY TOOLS                                 Page 52
  2821.  
  2822.  
  2823.  
  2824.  
  2825.                         Documentation for BATUTIL, Version 4.0
  2826.  
  2827.  
  2828.             You invoke a sound with BATUTIL by using the sound command which
  2829.       takes one or two parameters.  The first parameter must be an integer
  2830.       from 1 to 20 and indicates the sound from the above list.  The second
  2831.       parameter indicates the number of times to repeat the sound; if the
  2832.       second parameter is absent the sound is issued once.  For most sounds
  2833.       you won't want any repeats but for sound 3, you'll want a repeat count
  2834.       of 15 or more and sound 4 will do with a few repeats.  The repeat
  2835.       count must lie between 1 and 60.
  2836.  
  2837.             Thus
  2838.               batutil {SO 3 30}
  2839.       will repeat sound 3 thirty times.  The William Tell Overture is broken
  2840.       into two parts, to allow you to take an action in the middle as in
  2841.               batutil {EC CTRLALT Associates}{SO 18}{EC $Spresents}{SO 19}
  2842.  
  2843.             If you don't want the SOund command issued, you can use the
  2844.       NSound command.  This is intended primarily for use in the options
  2845.       set in the environment as in
  2846.             set @BU={NS}
  2847.       which would be useful if you normally had sounds in your batch files
  2848.       but were working late at night and didn't want to disturb others.  The
  2849.       {NS -} command would turn sound back on even if there is a previous
  2850.       {NS}.
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.       Chapter III: DISPLAY TOOLS                                 Page 53
  2875.  
  2876.  
  2877.  
  2878.  
  2879.                              Chapter IV:USER INPUT
  2880.  
  2881.  
  2882.       IV.1 Menu Basics
  2883.             Command: MEnu, NMouse
  2884.             Parameter: for MEnu, list of choices
  2885.  
  2886.             DOS provides very little in the way of user input to batch
  2887.       files - essentially the only way to modify the way a batch file
  2888.       runs from one time to the next is to change the parameters on the
  2889.       command line.  BATUTIL provides a number of alternates which we'll
  2890.       discuss in this chapter: you can pop up a menu from which the user
  2891.       chooses and have the choice returned in the errorlevel, you can have
  2892.       the user hit one of a specified number of keys, you can react to a
  2893.       specified state of the Capslock or Numlock or use a number of other
  2894.       devices.  You can also get an input string or filename from the user
  2895.       and store it in the environment but that command is most naturally
  2896.       described in detail in the next chapter. (see Sections V.4 and
  2897.       V.5).
  2898.  
  2899.             You can have BATUTIL pop up a menu of choices: you can have
  2900.       up to 16 choices - if you try more, BATUTIL will exit with an
  2901.       errorlevel over 200 set (and an error message if verbose mode is
  2902.       on).  Each choice can be up to 60 characters long (after metastring
  2903.       translation).  If the string is longer, then it is truncated at 60
  2904.       characters.  The syntax is
  2905.             batutil {MEnu choice1 choice2 choice3 ...}
  2906.       Each pair of choices must be separated by a space.  If you want a
  2907.       choice to appear with a space in the middle, use $S and rely on
  2908.       metastring translation to turn those into spaces.  For example
  2909.             batutil {ME choice$S1 choice$S2 choice$S3}
  2910.       would pop up a menu of the form
  2911.                            ╒══════════╕
  2912.                            │ choice 1 │
  2913.                            │ choice 2 │
  2914.                            │ choice 3 │
  2915.                            ╘══════════╛
  2916.  
  2917.             A highlight appear initially on the top choice and the
  2918.       following keys (plus others - see below) work:
  2919.             <Down>,<Tab>,<Spacebar>,<+> move the cursor down
  2920.             <Up>,<Shift-Tab>,<Backspace>,<-> move it up
  2921.             <Home>,<PgUp> go to the first choice
  2922.             <End>,<PgDn> go to the last choice
  2923.             <Esc> exits and sets the errorlevel to 0
  2924.             <Enter> makes the highlighted choice
  2925.       If the user picks the nth choice on the menu, the errorlevel is set
  2926.  
  2927.  
  2928.       Chapter IV:USER INPUT                                      Page 54
  2929.  
  2930.  
  2931.  
  2932.  
  2933.                         Documentation for BATUTIL, Version 4.0
  2934.  
  2935.  
  2936.       to n.
  2937.  
  2938.             In default mode, BATUTIL will look for a Microsoft compatible
  2939.       mouse and, if found, the mouse will work on the menus: moving the
  2940.       mouse up or down will move the highlighting and either mouse button
  2941.       will choose the highlighted item.  If you don't want the mouse
  2942.       active in the menus, use the {NMouse} command.
  2943.  
  2944.             The bar wraps around from top to bottom or vice versa.  The
  2945.       screen is saved upon menu pop up and restored on pop down.  In this
  2946.       version of BATUTIL, you cannot modify the menu colors or the border
  2947.       type.  BATUTIL automatically centers the menu on the screen both
  2948.       from left to right and top to bottom.  You cannot adjust the position
  2949.       of the menu in this version.
  2950.  
  2951.             BATUTIL gives special treatment to the first capital letter
  2952.       or number in each choice.  That symbol will appear in a special
  2953.       highlight and hitting that key will make that choice.  For example
  2954.             batutil {Copy Erase reName format eXit}
  2955.       will display a menu with five choices.  Hitting upper or lower case
  2956.       C, E, N, X will choose the first, second, third or fifth choice.
  2957.       There is no shortcut choice for "format" since no letter is
  2958.       capitalized.  Only the first capitalized letter in each choice
  2959.       counts so that if "Copy" were replaced by "COPY" only the first C
  2960.       would have a unique color and would be the quick key to make that
  2961.       choice.  If two different choices have the same capitalized letter,
  2962.       e.g. if "eXit" above were replaced by "Exit", only the first E
  2963.       would have the special color and only the first choice would be
  2964.       made if an <E> were hit.
  2965.  
  2966.             Future versions of BATUTIL may adopt the Windows standard use
  2967.       of & in menu choices so you should avoid the use of the & symbol in
  2968.       your menu choices (although && for & will be supported).
  2969.  
  2970.             Extra options for how menus look and/or choices are made can
  2971.       be found in the third section.  The sample batch file MENUDEMO.BAT
  2972.       will display sample menus and studying it should help clarify
  2973.       issues of syntax.
  2974.  
  2975.  
  2976.       IV.2 Getting a Menu from a File
  2977.             Command: FMenu
  2978.             Parameters: filename, optional label as a second parameter
  2979.  
  2980.  
  2981.  
  2982.       Chapter IV:USER INPUT                                      Page 55
  2983.  
  2984.  
  2985.  
  2986.  
  2987.                         Documentation for BATUTIL, Version 4.0
  2988.  
  2989.  
  2990.             If your menu has many choices or long descriptions, you will
  2991.       have trouble fitting it on a single DOS command line.  While
  2992.       suitable use of environmental variables and the $x command can get
  2993.       around that, a special command is provided for reading in a menu
  2994.       from a file.  The syntax of the FMenu command is the same as for
  2995.       FEcho and FPretty and is discussed in Sections I.5 and III.5.
  2996.  
  2997.             Leading and trailing spaces will be stripped and blank lines
  2998.       will be ignored.  The separate lines will then be viewed as
  2999.       separate lines in the constructed menus.  Embedded blanks will be
  3000.       treated as blanks, that is, unlike the MEnu command where blanks
  3001.       must be indicated with the $S command, blanks in FMenu do not
  3002.       require $S (although metastring translation is done so that $S will
  3003.       be interpreted as spaces).
  3004.  
  3005.             If you are reading in a menu from a file, you have the option of
  3006.       associating each menu item with a line of "help text".  After listing
  3007.       the menu items, place a line with an @ as the first nonblank
  3008.       character.  The rest of that line is ignored, but subsequent lines
  3009.       until the next : line will be regarded as help text.  They are
  3010.       associated in order, in a one-one way with menu choices.  If there are
  3011.       fewer help lines then menu lines, the final few menu items won't have
  3012.       help text.  If there are more help lines than menu items the last few
  3013.       help lines will be ignored.  Help text is displayed in the
  3014.       attributes set with the ATtr or MAttr commands and replaced with
  3015.       blanks in that attribute when the menu finishes.
  3016.  
  3017.  
  3018.       IV.3 Menu Options
  3019.             Commands: MHeader, POp, SHadow, FKey
  3020.             Parameters: MHeader takes a text string
  3021.                         POp takes a + or S to turn on sound effects
  3022.  
  3023.             There are a number of options you can choose which effect the
  3024.       appearance of menus popped up with the MEnu command and one of them
  3025.       effects which keys work.  If you wish you may add two extra lines
  3026.       to the top of the menu with the MHeader command.  The first line is
  3027.       a text string that you insert as a parameter to MH - spaces are
  3028.       allowed. The second is a graphic line.  The MH command must proceed
  3029.       the ME command.  So
  3030.             batutil {MH This is a header}{ME a b c d e}
  3031.       would display a menu in the form
  3032.  
  3033.  
  3034.  
  3035.  
  3036.       Chapter IV:USER INPUT                                      Page 56
  3037.  
  3038.  
  3039.  
  3040.  
  3041.                         Documentation for BATUTIL, Version 4.0
  3042.  
  3043.  
  3044.                            ╒══════════════════╕
  3045.                            │ This is a header │
  3046.                            ├──────────────────┤
  3047.                            │ a                │
  3048.                            │ b                │
  3049.                            │ c                │
  3050.                            │ d                │
  3051.                            │ e                │
  3052.                            ╘══════════════════╛
  3053.       The menu choices are always left justified while the header is
  3054.       centered.  You can use $S's to adjust this justification if you
  3055.       wish.  A blank MH, i.e. {MH}, will get ignored but {MH $S} would
  3056.       display a blank header.  Like menu choices, headers are truncated
  3057.       at 60 characters if they are longer than that after metastring
  3058.       translation.
  3059.  
  3060.             You can have the menu popup with a shadow effect by using the
  3061.       SHadow command.  The attributes of the shadow are the ones current
  3062.       set with the AT or MN commands.  A typical menu popup command might
  3063.       be set with
  3064.             batutil {AT 30}{CL}{SH}{AT 0}{ME choices.....}
  3065.       The first AT sets the attributes to black on cyan to produce a cyan
  3066.       screen when you CLear the screen.  The second AT then sets the
  3067.       attributes used by the shadow (black).
  3068.  
  3069.             You can have the menu visually explode when popping up and
  3070.       implode upon exiting.  You turn this effect on with the POp
  3071.       command.  POp will take an optional parameter of + or S to also
  3072.       turn on sound effects.  Try out MENUDEMO.BAT to see what the effect
  3073.       is.
  3074.  
  3075.             The final option is to turn on function keys with the FKey
  3076.       command so that
  3077.             batutil {FK}{ME choice1 choice2 choice3}
  3078.       will display a menu
  3079.                            ╒═════════════╕
  3080.                            │F1 - choice1 │
  3081.                            │F2 - choice2 │
  3082.                            │F3 - choice3 │
  3083.                            ╘═════════════╛
  3084.       with Fn labels indicated.  Now in addition to the other choices,
  3085.       the function keys will make choices as will the number keys.  FK
  3086.       will have an effect if your menu has nine or fewer choices.  It is
  3087.       ignored if the menu has more choices than that.
  3088.  
  3089.  
  3090.       Chapter IV:USER INPUT                                      Page 57
  3091.  
  3092.  
  3093.  
  3094.  
  3095.                         Documentation for BATUTIL, Version 4.0
  3096.  
  3097.  
  3098.             If you try to use multiple menus in a single running of
  3099.       BATUTIL, the options are all reset by the first menu displayed so
  3100.       that, for example the INclude code
  3101.             MH hi!
  3102.             FK
  3103.             ME a b c d
  3104.             ..misc BATUTIL commands
  3105.             ME 1 2 3 4}
  3106.       would display a header and function keys on the first menu but not
  3107.       the second.
  3108.  
  3109.             If the final option in an ME list is of the form the word WAIT
  3110.       followed by a number with NO spaces between WAIT and the number then
  3111.       that choice is not displayed but regarded as a time out in seconds.
  3112.       After the menu is up for that time without a choice being made, the
  3113.       menu will disappear and the errorlevel/RC will be set to the number
  3114.       of the WAIT option.  WA and WAI are also acceptable and are not case
  3115.       sensitive.  For example
  3116.             {ME Copy Erase Format eXit WA10}
  3117.       would exit with return code 5 after 10 seconds.  We recommend that
  3118.       the timeout value you use be a long time - typically 60 or more.  But
  3119.       do not use WAITs over 8000.
  3120.  
  3121.  
  3122.       IV.4 GEtkey Basics
  3123.             Command: GEtkey
  3124.             Parameters: list of "keys" separated by spaces, commas or
  3125.                                semicolons
  3126.  
  3127.             For many purposes where you want single key input, the MEnu
  3128.       command will be best but that is certainly overkill when you really
  3129.       want to ask something like
  3130.             Backup text files (Y/N)?
  3131.       where a simple <y> or <n> will suffice.  The GEtkey command is
  3132.       intended for these situations.  In its simplest form, the GEtkey
  3133.       command is followed by a set of "keys" separated by one of space,
  3134.       comma or semicolon (mixed choices are allowed) in the form:
  3135.             batutil [GEtkey key1 key2 ....]
  3136.       where the syntax for allowed keys will be discussed below.  BATUTIL
  3137.       will then wait patiently for the user to hit one of the keys in the
  3138.       list and then exit with the errorlevel set to n if choice n was
  3139.       made.  For example
  3140.             batutil [GEtkey y n]
  3141.       would wait patiently for one of y,Y,n,N and set the errorlevel to 1
  3142.  
  3143.  
  3144.       Chapter IV:USER INPUT                                      Page 58
  3145.  
  3146.  
  3147.  
  3148.  
  3149.                         Documentation for BATUTIL, Version 4.0
  3150.  
  3151.  
  3152.       if y or Y were picked and 2 if n or N were picked.
  3153.  
  3154.             By default, the keys are not case sensitive so that as above
  3155.       y or Y will work.  Also, by default, BATUTIL will flush the
  3156.       keyboard buffer before getting a keystroke.  BATUTIL will also echo
  3157.       the choice made to give the user feedback and by default will
  3158.       display nothing in response to a key not corresponding to any
  3159.       choice.  However, these defaults, including whether there is any
  3160.       visible echo, can be changed as we'll explain in the next section.
  3161.       The maximum number of keys that can be listed is 40.
  3162.  
  3163.             BATUTIL doesn't mind if a key is repeated in the list of keys
  3164.       but it will report the first match so that
  3165.             batutil [GE Y Y y n n y y n]
  3166.       would return errorlevel 1 with a y or Y and errorlevel 4 with an n
  3167.       or N.
  3168.  
  3169.             Unlike STACKEY, BATUTIL does not distinguish between the grey
  3170.       plus and the top row plus nor between the top row numbers and the
  3171.       number pad numbers.
  3172.  
  3173.             Here are the possible choices for keyn in the basic syntax
  3174.       (the two letter codes are essentially those recognized by STACKEY
  3175.       with exceptions like G+ as described above, and the fact that this
  3176.       version does not support keys special to the enhanced keyboard.)
  3177.  
  3178.               -  any single ASCII character with some exceptions given
  3179.                       below
  3180.               -  # followed by any number from 0 to 255 indicating
  3181.                       precisely that ASCII code (there must be no spaces
  3182.                       between the # and the number)
  3183.               -  F1,..,F0; S1,..,S0; A1,..,A0; C1,..,C0 for the 40
  3184.                       function keys as in STACKEY
  3185.               -  ^ followed by any upper or lower case letter for the
  3186.                       control-character, e.g. ^B for <Ctrl-B>
  3187.               -  ^ followed by one of [ \ ] ^ _ for those special ASCII
  3188.                       codes, e.g. ^[ for <Esc>
  3189.               -  ^1, ^3, ^4, ^6, ^7, ^9 for <Ctrl-End>...<Ctrl-PgUp> as
  3190.                       in STACKEY
  3191.               -  @ followed by an alphabetic letter, number, -, _, + or =
  3192.                       indicated the Alt-combination as in STACKEY, e.g.
  3193.                       @A for <Alt-A>
  3194.               -  The following two letter codes which have the same
  3195.                       meaning as in STACKEY: FF, ST, SP, SQ, CB, CR, LA,
  3196.  
  3197.  
  3198.       Chapter IV:USER INPUT                                      Page 59
  3199.  
  3200.  
  3201.  
  3202.  
  3203.                         Documentation for BATUTIL, Version 4.0
  3204.  
  3205.  
  3206.                       RA, UA, DA, TA, ES, TB, BT, BS, LF, DQ, IN, DE, HM,
  3207.                       EN, PU, PD; for example ES for <esc>.
  3208.  
  3209.             The following ASCII codes cannot be used as a single code
  3210.       because they have special meaning to DOS or to BATUTIL:
  3211.  
  3212.             ASCII code (symbol in paren)   │     Use instead
  3213.       ─────────────────────────────────────┼─────────────────────
  3214.              #13 (carriage return)         │   #13, CR, ^M
  3215.              #10 (line feed)               │   #10, LF, ^J
  3216.              >                             │   #62
  3217.              <                             │   #60
  3218.              |                             │   #124
  3219.              %                             │   #37
  3220.              #26 (control Z)               │   #26, ^Z
  3221.               {                            │   #123
  3222.               }                            │   #125
  3223.               [                            │   #81
  3224.               ]                            │   #83
  3225.               ,                            │   #44
  3226.              <space>                       │   #32, SP
  3227.               ;                            │   #59
  3228.  
  3229.  
  3230.       IV.5 GEtkey Options
  3231.             Commands: NFlush, CSent, VIsual, ATtribute
  3232.             Metastring: $L
  3233.             Parameters: For VI - A,1,N,D,DA,D1,DN
  3234.                         For AT - Tmn with m,n integers
  3235.             Extra GEtkey parameters: in first place WAitnn for wait
  3236.                            in first place WAitEnn for wait with Echo
  3237.                            in last place BEep or ELse
  3238.  
  3239.             GEtkey has various extra options to make it more flexible.
  3240.       While it is normally case insensitive, by preceding it with CSent,
  3241.       it will become case sensitive.  For example
  3242.             batutil {CS}{GE Y N}
  3243.       would only accept Y and N and not y or n.
  3244.  
  3245.             Similarly, NFlush will avoid the default behavior which is to
  3246.       flush the keyboard before getting a keystroke.
  3247.  
  3248.             You can adjust the visible feedback that GEtkey gives with the
  3249.       VIsual command.  This command takes a parameter which tells it what
  3250.  
  3251.  
  3252.       Chapter IV:USER INPUT                                      Page 60
  3253.  
  3254.  
  3255.  
  3256.  
  3257.                         Documentation for BATUTIL, Version 4.0
  3258.  
  3259.  
  3260.       to do.  The choices are the following:
  3261.             The default which echoes the choice the user makes as written
  3262.                in the GEtkey command line, e.g. if you use
  3263.                  batutil {GE Y #78}
  3264.                (N is ASCII 78) and the user picks N, then "#78" is echoed
  3265.             1 which will only echo 1 character choices, e.g. with the
  3266.                above example, Y would get echoed but not #78
  3267.             N which suppresses the visual echo (N for No)
  3268.             A which provides an echo for all user responses: if
  3269.                the choice is not one on the list a character plus a
  3270.                ? appears.  For alphanumeric characters, the
  3271.                character itself is used.  For all other keys
  3272.                an upside down question mark appears as the first
  3273.                character.  The incorrect choice indicator is
  3274.                erased each time a new choice is made.
  3275.  
  3276.             By default, BATUTIL inserts a space before echoing a response
  3277.       so that a Y response to
  3278.             batutil {EC Are you sure(Y/N)?}{GE Y N}
  3279.       would appear on the screen as:
  3280.             Are you sure(Y/N)? Y
  3281.       with a space after the question mark.  If you Don't want this space
  3282.       use a D in the visual command.  You can combine the D parameter with
  3283.       another one so long as you place the D first and place no space
  3284.       after it.  Thus
  3285.             batutil {VI da}{GE Y N}
  3286.       would provide an echo to all choices with no leading space.
  3287.  
  3288.             In addition, the GEtkey command itself has extra options for
  3289.       parameters other than a list of keys.  The last "key" in the list
  3290.       can be one of the key words BEep or ELse (as usual, two letter
  3291.       truncations are allowed).  If the keyword BEep occurs, then the
  3292.       user is beeped for every wrong key picked.  PLEASE use this
  3293.       sparingly.  We hate programs that beep too much and offer it with
  3294.       some misgivings.  Be careful since
  3295.             batutil {GE BE}
  3296.       will do a pretty good imitation of a machine that has crashed
  3297.       (^Break will get you out).
  3298.  
  3299.             If the keyword ELse occurs as the last "key", then rather than
  3300.       wait patiently for a key on the list to be hit, BATUTIL will exit
  3301.       with any key hit.  If the key is not on the list then the
  3302.       errorlevel is set to the position of the word "else"; for example
  3303.             batutil {GE y n else}
  3304.  
  3305.  
  3306.       Chapter IV:USER INPUT                                      Page 61
  3307.  
  3308.  
  3309.  
  3310.  
  3311.                         Documentation for BATUTIL, Version 4.0
  3312.  
  3313.  
  3314.       would return errorlevel 1 if y or Y is hit, 2 if n or N is hit and
  3315.       3 for any other key.  If ELse is used a VIsual level of A is ignored.
  3316.  
  3317.             The final option concerns the first "key" on the list which
  3318.       can be WAit followed without any spaces by a number, N, from 1 up
  3319.       to over 8,000 (you will not get an error over 8000 but the response
  3320.       will not be what you expect) or followed by the letter E and a
  3321.       number.  BATUTIL will then not wait patiently for a key to be struck
  3322.       but after approximately N seconds, it will exit with an errorlevel
  3323.       of 0 if no other choice is made.  Thus two lines in a batch file
  3324.       like
  3325.             batutil {GE WA3 y n}
  3326.             if errorlevel 2 goto No
  3327.       would have the effect of choosing a default choice of Y if no key
  3328.       is struck for 3 seconds.  The letter E between the number and WAit
  3329.       tells BATUTIL to echo the first choice on the list if the exit is
  3330.       due to a timeout.  This is for use in examples like the above where
  3331.       the timeout choice will pick a default.  To get the visual feedback
  3332.       for timeout in the above you'd use {GE WAE3 y n}.
  3333.  
  3334.             There is a system dependent end effect involving the time to
  3335.       load BATUTIL so that WA1 is likely to be anywhere between 1/2 and 2
  3336.       seconds and WA10 will be between 8 and 12 seconds.  In addition, if
  3337.       you start with the GEtkey list with a WAit and end with a BEep and
  3338.       the user holds down the wrong key, then the time before (merciful)
  3339.       exit will be longer than you asked for because beeping takes a
  3340.       considerable amount of time and is not included in the count down
  3341.       time.
  3342.  
  3343.             There may be times that you'll want to visually count down
  3344.       the remaining time.  BATUTIL stores two internal parameters called
  3345.       the timerow and timecolumn, initially set to zero.  If both numbers
  3346.       have no zero values than a countdown will take place with numbers
  3347.       in the row numbered timerow and beginning in column number
  3348.       timecolumn.  There are two ways to change these two parameters.
  3349.       The ROw and COl commands can take the form
  3350.               {RO Ty}{CO Tx}
  3351.       to change these parameters to the numbers y and x.  y must lie in
  3352.       the range 1 to the screen height and x in the range 1 to the
  3353.       screen width.
  3354.  
  3355.             Secondly, if you use $L (L for Location) in an ECho or PRetty
  3356.       command, nothing is displayed for the $L but timerow and timecolumn
  3357.       are set to the current cursor position so
  3358.  
  3359.  
  3360.       Chapter IV:USER INPUT                                      Page 62
  3361.  
  3362.  
  3363.  
  3364.  
  3365.                         Documentation for BATUTIL, Version 4.0
  3366.  
  3367.  
  3368.             batutil {EC Time left: $L   seconds}{GE WA60}
  3369.       will work the way that you'd expect.  Notice that there are three
  3370.       spaces after the $L - two for the numbers 59,.... which will appear
  3371.       and one for a space before the word.
  3372.  
  3373.             There are two additional parameters that you can use with
  3374.       GEtkey WAit and this display.  They are set with
  3375.             {AT Tmn}
  3376.       where m defaults to 3 and n to 4.  m can be from 0 to 3 (the 0 need
  3377.       not be explicit) and adjusts how much is the time is offset.  To
  3378.       take into account the time to load BATUTIL, GEtkey WAits actually
  3379.       subtracts 3/4 of a second off from the time counted so if you ask
  3380.       to count from 60, the time will start at 59.  The wait is m/4
  3381.       seconds if you set m.  In addition, you can change the number
  3382.       counted with n.  Time is counted down in units of n times 1/4
  3383.       second with n between 1 and 8.  So n=2 is half second and n=8 is 2
  3384.       second pauses.  The countdown is in this unit BUT the number set
  3385.       after {GEtkey WAit} is always interpreted as seconds.
  3386.  
  3387.  
  3388.       IV.6 AScii, SCanread
  3389.             Commands: AScii, SCanread
  3390.             Every keystroke returns a "scan code" and an ASCII code -
  3391.       these are the int 16 codes as discussed in Section VI.1 of the
  3392.       STACKEY documentation.  The commands {SC} and {AS} wait for the
  3393.       next key to be pressed and return respectively the scan code or ASCII
  3394.       part.  They are sensitive to the prior use of NFlush.  That is, by
  3395.       default, the keyboard buffer is flushed before reading but a prior
  3396.       use of {NF} can suppress the buffer flushing.
  3397.  
  3398.             SCan codes are always smaller than 128 but ASCII codes could
  3399.       be above 200.  This command is one of only two commands that can return
  3400.       an errorlevel above 200 without indicating an error (the other one is
  3401.       the RUn command).
  3402.  
  3403.  
  3404.       IV.7 Username/Password Checking
  3405.             Command: USername
  3406.             Parameters: sequence of names; first one can be a number of
  3407.                           tries; second can be *
  3408.  
  3409.             You may have a batch file which you want to branch depending
  3410.       on what "username" the user enters.  This is what the USername
  3411.       command is for.  The simplest syntax is
  3412.  
  3413.  
  3414.       Chapter IV:USER INPUT                                      Page 63
  3415.  
  3416.  
  3417.  
  3418.  
  3419.                         Documentation for BATUTIL, Version 4.0
  3420.  
  3421.  
  3422.             batutil {US name1 name2 name3 ....}
  3423.       with names separated by spaces.  The names cannot have more than one
  3424.       word since metastring translation does NOT take place.  BATUTIL will
  3425.       display an edit box preceded by ===> which allows entry of a name up to
  3426.       20 characters.  The usual edit keys work.  After the user presses
  3427.       <Enter>, the string entered is compared with the list of names - if
  3428.       there is a match with the Nth name on the list, an errorlevel of N is
  3429.       returned.  Otherwise an error level of 0 is returned.
  3430.  
  3431.             As an option, the first parameter can be a number.  In that
  3432.       case, that number indicates an additional number of tries which are
  3433.       allowed.  If N is 3 or more, and the first entry isn't a match,
  3434.       BATUTIL will beep and display the message:
  3435.             Please try again  ===>
  3436.       When there is only one try left, (and in particular if N=2 after
  3437.       the first try), the message
  3438.             Only one more try ===>
  3439.       will appear.
  3440.  
  3441.             There is another special and VERY DANGEROUS option to be used
  3442.       with care.  If the first parameter is a number and the second
  3443.       parameter is a * as in
  3444.             batutil {US 1 * abc def}
  3445.       then if the number of chances is exhausted, rather than return an
  3446.       error level of 0, BATUTIL will respond
  3447.             Invalid!  System halted
  3448.       and go into a tight loop.  This is a very crude security measure
  3449.       since even if you place it in your autoexec.bat, booting from a
  3450.       floppy can give an intruder access to your system.  But it will be
  3451.       effective against an unsophisticated but nosy intruder.
  3452.  
  3453.             When either the number or number and * options are used, the
  3454.       numbering of choices is counted starting after these optional special
  3455.       parameters.  That is, in the last example, "abc" would set an errorlevel
  3456.       of 1 and "def" an errorlevel of 2.
  3457.  
  3458.             By default, USername is not case sensitive and flushes the
  3459.       buffer before asking for input but either of these can be changed
  3460.       by a prior use of {CS} or {NF} as described in Section IV.4.
  3461.  
  3462.  
  3463.       IV.8 Parameter Matching
  3464.             Command: PMatch
  3465.             Parameters: list of words
  3466.  
  3467.  
  3468.       Chapter IV:USER INPUT                                      Page 64
  3469.  
  3470.  
  3471.  
  3472.  
  3473.                         Documentation for BATUTIL, Version 4.0
  3474.  
  3475.  
  3476.             The PMatch command is followed by a list of words as in
  3477.             batutil {PM word0 word1 ....}
  3478.       It checks word0 against each of word1, ....  If there is a match
  3479.       first with wordN the error level is set to N, otherwise to 0.  This
  3480.       is typically used to check for errors in batch file parameters.  For
  3481.       example if allowed parameters are "comp" and "bold", you could use
  3482.             echo off
  3483.             batutil {PM %1 comp bold}
  3484.             if errorlevel 1 goto %1
  3485.             echo %1 is not a valid choice; use COMP or BOLD
  3486.             goto end
  3487.             :comp
  3488.             LINES for comp
  3489.             goto end
  3490.             :bold
  3491.             LINES for bold
  3492.             :end
  3493.       This has several advantages over the more usual sequence of
  3494.             if %1 == bold goto bold
  3495.       First, it is only one command.  Secondly, because labels are not
  3496.       case sensitive, you can use "goto %1" to handle all the different,
  3497.       Bold, BOLD, etc. cases.
  3498.  
  3499.             By default, PM is not case sensitive but you can make it so
  3500.       with the {CS} command if you wish.
  3501.  
  3502.  
  3503.       IV.9 Querying the Lock Status
  3504.             Command: QLock
  3505.             Parameter: first is C, S, N or I; second (optional) is + or -
  3506.  
  3507.             If you have a long autoexec.bat file which branches in the
  3508.       middle, you may want to set it up with a Y/N question which uses
  3509.       GEtkey with the WA parameter to pick a default choice.  But suppose
  3510.       you don't want the default choice.  Is there any way to overrule
  3511.       the default without waiting around for the Y/N question to appear?
  3512.       The QLock command is precisely made for such situations.  It will
  3513.       read the status of CapsLock or NumLock or etc. and return it in the
  3514.       errorlevel.  So you could test for the CapsLock as an antidote to
  3515.       the automatic yes.  We'll describe an example of this in Section
  3516.       VI.3.
  3517.  
  3518.             QLock takes one mandatory parameter and one optional one.
  3519.       The mandatory one determines which lock will get queried; the
  3520.  
  3521.  
  3522.       Chapter IV:USER INPUT                                      Page 65
  3523.  
  3524.  
  3525.  
  3526.  
  3527.                         Documentation for BATUTIL, Version 4.0
  3528.  
  3529.  
  3530.       choices are C, S, N and I for CapsLock, ScrollLock, NumLock and
  3531.       Insert.  Thus
  3532.             batutil [QL C]
  3533.       will test the state of CapsLock and set the errorlevel to 1 if it
  3534.       is on and 0 if it is off.
  3535.  
  3536.             The optional parameter is a + (resp. -) which makes sure that
  3537.       the lock state is left on (resp. off) when BATUTIL is done.  For
  3538.       example
  3539.             batutil [QL C -]
  3540.       would read the lock state but make sure that it was off when the
  3541.       process was done.
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.       Chapter IV:USER INPUT                                      Page 66
  3577.  
  3578.  
  3579.  
  3580.  
  3581.                         Chapter V:ENVIRONMENTAL CONTROL
  3582.  
  3583.       V.1 Environmental Impact Statement
  3584.  
  3585.             DOS keeps an area of memory called the active environment
  3586.       where it stores the information that you put in your PROMPT and
  3587.       PATH commands and where it stores the location of the file
  3588.       command.com.  In addition, some programs ask you to store
  3589.       information there which you place with the SET command.  Because
  3590.       the DOS command line is limited to 127 characters, you are unable
  3591.       with DOS tools to have a prompt string over 120 characters (127
  3592.       minus the length of "prompt=") nor a path over 122 characters.  The
  3593.       syntax of the set command is
  3594.             set foo=string
  3595.       and we will refer to "foo" as the variable name and "string" as the
  3596.       value of foo.
  3597.  
  3598.             Programs, when they load, are given a copy of this active
  3599.       environment and it is this copy that they are supposed to consult
  3600.       or modify.  The location of the active environment is undocumented
  3601.       and programs are not "supposed" to access it.
  3602.  
  3603.             Batch files can access the environment - if the string
  3604.                  %foo%
  3605.       appears anywhere in a batch file, DOS looks for a variable "foo" in
  3606.       the active environment and if it finds it, then %foo% is replaced by
  3607.       this string.  If there is not a variable named foo, then %foo% is
  3608.       replaced by the empty string.  This %foo%, which only works in
  3609.       batch files, was undocumented until DOS 3.3 but has worked in all
  3610.       versions of DOS.
  3611.  
  3612.             BATUTIL gives you considerable control over the active
  3613.       environment including the following:
  3614.             -  you can query the user and have the answered stored in the
  3615.       environment
  3616.             -  You can have environmental strings up to 255 characters
  3617.       rather than the DOS 127 character limit and, in particular, your
  3618.       PATH can be up to 250 characters and your PROMPT up to 248
  3619.             -  you can add or delete directories from your path.
  3620.             -  you can get a more informative report of what is in your
  3621.       environment than what DOS supplies with the SET command
  3622.             -  you can call up an editor to edit by hand the path or the
  3623.       environment as a whole
  3624.             -  you can save the current environment to a file and later
  3625.       reload it.
  3626.  
  3627.  
  3628.  
  3629.  
  3630.       Chapter V:ENVIRONMENTAL CONTROL                            Page 67
  3631.  
  3632.  
  3633.  
  3634.  
  3635.                         Documentation for BATUTIL, Version 4.0
  3636.  
  3637.  
  3638.             !!!WARNING!!!  BATUTIL can do these things by directly
  3639.       accessing the DOS active environment which violates the general
  3640.       guidelines for "well behaved" programs and uses undocumented
  3641.       features.  We have extensively tested these things with many
  3642.       versions of DOS and we feel that these actions are safe BUT you use
  3643.       these undocumented commands at your own risk.  BATUTIL has certain
  3644.       safeguards built in so that it will exit with an error code if it
  3645.       doesn't find an appropriate candidate for the environment so it
  3646.       should be safe but CTRLALT Associates cannot be responsible for any
  3647.       problems caused by your willingness to use our attempt at giving
  3648.       you improved performance by mildly violating the rules.
  3649.  
  3650.             Early versions of DRDOS 5.0 were incompatible with BATUTIL
  3651.       because of the environment handling.  But this is not a problem with
  3652.       later version of DRDOS 5.0 and with DRDOS 6.0 so long as a shell of
  3653.       DR DOS isn't run.  All version of MSDOS to date are compatible with
  3654.       BATUTIL with or without a shell.
  3655.  
  3656.             DOS' treatment of the environment has varied from version to
  3657.       version and while we have tested it under DOS 2.0 thru 5.0, there
  3658.       is a chance that we will not find the proper environment under
  3659.       future versions of DOS.  In addition we have tested running with a
  3660.       path over 122 characters in length and DOS seems to behave
  3661.       perfectly.  However, an application program might get unhappy at
  3662.       finding a path over what it regards as the theoretical maximum.
  3663.       Indeed, Flambeaux Software's TechHelp!! crashes while loading with a
  3664.       path of more than 122 characters and 1986 versions of PKXARC behave
  3665.       erratically with a long path.
  3666.  
  3667.             IMPORTANT NOTES: DOS' SET command only displays the first 128
  3668.       characters in each environmental string.  You may think that
  3669.       BATUTIL has failed to increase your path beyond 128 bytes if you
  3670.       just try set, but the full path will work.  Use batutil {EN} to get
  3671.       a full report of all the strings of any length up to 255 bytes.  If
  3672.       you use another program to get environmental strings over 255 bytes
  3673.       in length, BATUTIL will refuse to load.  If you need strings over
  3674.       255 bytes, let us know and BATUTIL may support them in a future
  3675.       version.
  3676.  
  3677.             Especially with the extra capability that BATUTIL gives you,
  3678.       you may find the 160 character default environment provided by DOS
  3679.       is too small.  You can get around this in two ways:
  3680.             DOS 3.1 has an undocumented option and DOS 3.2/3.3/4.0/5.0 a
  3681.       documented option to change the environment with the following command
  3682.  
  3683.  
  3684.       Chapter V:ENVIRONMENTAL CONTROL                            Page 68
  3685.  
  3686.  
  3687.  
  3688.  
  3689.                         Documentation for BATUTIL, Version 4.0
  3690.  
  3691.  
  3692.       in your CONFIG.SYS:
  3693.             shell=C:\command.com /P /E:xxxx
  3694.       where C:\ can be replaced by whatever path points to command.com
  3695.       and xxxx is the number of bytes you want in the environment under
  3696.       DOS 3.2-5.0 and it is the number of 16 byte units under DOS 3.1.
  3697.       Thus for a 512 byte environment you'd replace xxxx by 512 under DOS
  3698.       3.2-5.0 and by 32 under DOS 3.1.
  3699.  
  3700.             The second method which you'll need under DOS versions prior
  3701.       to DOS 3.1 is to patch command.com.  Information for such patches
  3702.       is available on many bulletin board systems.
  3703.  
  3704.             SHELLs under DOS 3.2 and later can have enlarged environments.
  3705.       Just use
  3706.             command /e:xxxx
  3707.       where xxxx is the number of bytes that you want environment in the
  3708.       shell of DOS to have.
  3709.  
  3710.             Softlogic's Software Carousel sets up a larger environment in its
  3711.       partitions than you specified in a shell command in your config.sys and
  3712.       since BATUTIL reflects reality, it will report this larger environment
  3713.       size.
  3714.  
  3715.            JP Software's 4DOS program in certain modes INCLUDING the
  3716.       default for Version 2.1 will not work with BATUTIL.  Instead
  3717.       BATUTIL will exit with an error message.  In order for BATUTIL to
  3718.       work with 4DOS you must:
  3719.            -  have Version 3.00 or later of 4DOS
  3720.            -  or a Version after 2.10 and you load 4DOS with the /M:xxxx
  3721.       (where xxxx is the desired environment size) switch
  3722.             In addition, be warned that there is a special problem that
  3723.       arises if you try to run 4DOS and BATUTIL together on a system
  3724.       whose underlying DOS version is 3.2.  If you load a shell of 4DOS
  3725.       (perhaps as the base command processor) and then load a shell of
  3726.       command.com, BATUTIL will not change the active DOS environment but
  3727.       another memory area.  No harm will be done but you will not effect
  3728.       the path or other DOS variables in this rather special
  3729.       circumstance.
  3730.  
  3731.  
  3732.       V.2 Environment Reports
  3733.             Command: ENvrep
  3734.  
  3735.  
  3736.  
  3737.  
  3738.       Chapter V:ENVIRONMENTAL CONTROL                            Page 69
  3739.  
  3740.  
  3741.  
  3742.  
  3743.                         Documentation for BATUTIL, Version 4.0
  3744.  
  3745.  
  3746.             The command
  3747.               batutil {ENvrep}
  3748.       will display a listing of all environmental strings as DOS' SET
  3749.       command does but it will also list the following:
  3750.             - the length of each environmental string
  3751.             - the total size and amount of free space in the environment
  3752.             - the location of the active environment
  3753.  
  3754.  
  3755.       V.3 SEt Basics
  3756.             Command: SEt
  3757.             Parameters: var1=string1 var2=string2 (separated by spaces)
  3758.  
  3759.             BATUTIL has a SEt command that lets you place variables into
  3760.       the environment.  The syntax is
  3761.             batutil {SE foo1=string1 foo2=string2 ...}
  3762.       You can enter more than one string at a time (although one string
  3763.       is also allowed).  Distinct strings are separated by spaces.  If any
  3764.       string is missing an = sign, BATUTIL will exit with an errorlevel of
  3765.       208 (and issues a message if you are in Verbose mode).  If you want
  3766.       to place a space into the value of one of the strings, use $S which
  3767.       will get translated into a space.
  3768.  
  3769.             "But", you say, "DOS' SET lets me put strings in the
  3770.       environment, so why do I need BATUTIL."  Often DOS is the way to go
  3771.       but BATUTIL's SEt has the following advantages:
  3772.  
  3773.             - You can place more than one variable into the environment
  3774.       at a time
  3775.             - BATUTIL does metastring translation so that you could use
  3776.       something like
  3777.                  batutil {SE today=$E}
  3778.       to get today's date in English into the environment or if you want
  3779.       Ctrl-Z as part of your prompt string (the right pointing arrow is an
  3780.       interesting alternative to the more usual greater than sign), then
  3781.       you'll have trouble doing that from a batch file but the pair of
  3782.       symbols ^ and Z in a BATUTIL SEt will work, e.g.
  3783.                batutil {SE prompt=$$p)^z}
  3784.             - You can use SEt to get variable values of length over 127
  3785.       characters into the environment (see below).
  3786.  
  3787.             As with DOS' set command, {SE foo=} with no string after
  3788.       "foo=" will remove any variable named "foo" from the environment.
  3789.  
  3790.  
  3791.  
  3792.       Chapter V:ENVIRONMENTAL CONTROL                            Page 70
  3793.  
  3794.  
  3795.  
  3796.  
  3797.                         Documentation for BATUTIL, Version 4.0
  3798.  
  3799.  
  3800.             Because of the metastring translation, you'll need to
  3801.       exercise some care when using prompt strings.  For example, if your
  3802.       prompt were
  3803.             $t$_$p$g
  3804.       which displays the time and then on a second line the path and a
  3805.       '>', and you decided to add the date and used
  3806.             batutil {SE prompt=$d;$X(prompt)}
  3807.       you'd not get what you wanted.  The $d would get translated into
  3808.       today's date (which wouldn't be bad although it would waste
  3809.       environment space) but the $t and $p would get "evaluated" and
  3810.       would no longer change as you the time changed or you changed
  3811.       directory.  Instead you should use
  3812.             batutil {SE prompt=$$d;$x(prompt)}
  3813.       (recall that $X does metastring translation while $x does not).
  3814.       Careful use of $x, $$ and occasional use of the {$T - } will avoid
  3815.       problems but care is needed.
  3816.  
  3817.             DOS is limited to 127 characters on a command line and it
  3818.       does %foo% translations at a point where that limitation is still
  3819.       in effect so that if your path has 120 characters and you use the
  3820.       DOS command
  3821.             set path=%path%;C:\bin;
  3822.       in a batch file, DOS will expand the %path% and crowd all but the
  3823.       ";C" off the line.  But BATUTIL only does the translation later and
  3824.       allows environmental strings up to 255 characters so that
  3825.             batutil {SE path=$x(path);C:\bin;}
  3826.       would work perfectly - it is with the use of the $x command that
  3827.       you can get environment strings over 127 characters (as well as
  3828.       with the ADdpath and LOadenv) commands.  Actually, you wouldn't
  3829.       want to use the above command line - adding to your path is
  3830.       sufficiently important that it is a primitive BATUTIL command and
  3831.       you'd use:
  3832.             batutil {AD C:\bin}
  3833.  
  3834.  
  3835.       V.4 Internal Variables and Hacker Mode
  3836.             Commands: $1,...$9,$é,...$ò, ++, --
  3837.  
  3838.             While the SEt command will normally set an environmental
  3839.       variable, there are two sets of exceptions where special values of
  3840.       the variable, var, in
  3841.             var=value
  3842.       will set something else: internal variables and hacker mode pokes.
  3843.  
  3844.  
  3845.  
  3846.       Chapter V:ENVIRONMENTAL CONTROL                            Page 71
  3847.  
  3848.  
  3849.  
  3850.  
  3851.                         Documentation for BATUTIL, Version 4.0
  3852.  
  3853.  
  3854.             BATUTIL has 32 internal variables of which 30 can be set by the
  3855.       user.  These variables are discussed in Section VI.1.  The basic
  3856.       syntax is
  3857.             SEt $1=value
  3858.       Metastring translations of 'value' are as in the ordinary SEt
  3859.       command, the only difference being that instead of placing the value
  3860.       in the environment preceded by $1=, it is stored internally by
  3861.       BATUTIL.  You can set multiple internal variables in a single set
  3862.       command or mixed internal and environmental variables.
  3863.  
  3864.             If a command starts with $1, etc., an implied SET is added
  3865.       before it so that
  3866.             $1=$E foo=bar
  3867.       is equivalent to
  3868.             SEt $1=$E foo=bar
  3869.       Note it is important to have no space between the $1 and the =.
  3870.  
  3871.             ++ and -- are shorthand for incrementing/decrementing an
  3872.       internal or environmental variable.  That is
  3873.             ++$1
  3874.       is the same as ($V is discussed in Section VI.3)
  3875.             SEt $1=$V($1+1)
  3876.       and similarly for --$1 and $V($1-1).  If ++ is followed by any string
  3877.       other than the thirty internal variables, it is treated as an
  3878.       environmental variable so that, for example
  3879.             ++ foo
  3880.       translates to
  3881.             SEt foo=$V($x(foo)+1)
  3882.  
  3883.             Notice that if $1 is empty to start with $V($1+1) becomes
  3884.       $V(+1) which is 1 so empty variables act like a 0 under ++ or --.
  3885.  
  3886.             In the SEt command $Z and $z for the value of variable have a
  3887.       special effect and do not set environmental variables.  See Section
  3888.       VI.13.
  3889.  
  3890.  
  3891.       V.5 Getting User Strings into the Environment
  3892.             Commands: ?Length, ?Size, LEngth, QUery
  3893.             Parameters: ?L takes a number from 1 to 255
  3894.                         ?S takes a number from 1 to 80
  3895.                         LE takes a string
  3896.                         QU takes -
  3897.             Metastrings: $Q, $?, $¿, $N
  3898.  
  3899.  
  3900.       Chapter V:ENVIRONMENTAL CONTROL                            Page 72
  3901.  
  3902.  
  3903.  
  3904.  
  3905.                         Documentation for BATUTIL, Version 4.0
  3906.  
  3907.  
  3908.             As part of the set command, you can query the user for a
  3909.       string to be placed into the environment.  The metastrings $Q and
  3910.       $? are used with slightly different display possibilities.  Do not
  3911.       confuse $q (the prompt metastring for the character =) and $Q, the
  3912.       Query command.  The usual form that you'll use is
  3913.             batutil {SE foo=$Q}
  3914.       or
  3915.             batutil {SE foo=$?}
  3916.       although there is no reason that $Q or $? couldn't be part of a
  3917.       complex string.  Only one $Q or $? will be translated per string so
  3918.       that
  3919.             batutil {SE foo=$Q$Q$?}
  3920.       would Query the user and append the characters "$Q$?" to the end of
  3921.       the input.  But multiple strings each with its own query are in
  3922.       principle possible so that
  3923.             batutil {SE foo1=$Q foo2=$Q}
  3924.       would query the user twice.
  3925.  
  3926.             You will need to place an appropriate prompt on the screen to
  3927.       indicate to the user what you expect as in
  3928.             batutil {EC Enter filename to use$_}{SE foo=$Q}
  3929.       or
  3930.             batutil {EC Enter two filenames to use$_}{SE foo1=$Q foo2=$Q}
  3931.  
  3932.             With the $Q command, the BATUTIL adds it own prompt of
  3933.                 ===>
  3934.       in distinctive colors (yellow on black on a color monitor) and then
  3935.       displays an edit box in reverse video on a monochrome screen and
  3936.       yellow on green on a color monitor.  The edit box is 50 columns
  3937.       wide and the maximum string length that can be entered is 80
  3938.       characters (with horizontal scrolling as described in Section I.7).
  3939.       These can be adjusted with the ?L and ?S commands as we'll
  3940.       describe.  All the editing commands discussed in Section I.7 are
  3941.       active.
  3942.  
  3943.             The $? gives you more control over the display but at the
  3944.       "cost" of more effort on your part.  You can customize your own
  3945.       prompt.  Rather than use a fixed set of attributes, the AT and MN
  3946.       attributes are used to determine the colors of the edit window.
  3947.       For example, to duplicate
  3948.             batutil {SE foo=$Q}
  3949.       you'd use
  3950.             batutil {AT 0E}{EC ===$g$S}{AT 2E}{MN 70}{SE foo=$?}
  3951.       Of course, you would not do this to duplicate $Q but you can adjust
  3952.  
  3953.  
  3954.       Chapter V:ENVIRONMENTAL CONTROL                            Page 73
  3955.  
  3956.  
  3957.  
  3958.  
  3959.                         Documentation for BATUTIL, Version 4.0
  3960.  
  3961.  
  3962.       colors and prompts in this way.
  3963.  
  3964.             The {$T -} command does NOT turn off $Q/$? expansion.
  3965.       Rather you can turn this off independently of the state of $T with
  3966.       the QUery command: {QU -} would turn it off and {QU +} will turn it
  3967.       back on.
  3968.  
  3969.             While the default maximum length of input for the $Q and $?
  3970.       commands is 80 characters, you can adjust this with the ?L command.
  3971.       Similarly, the ?S command effects the size of the edit window.
  3972.       Thus
  3973.             batutil {?L 30}{?S 5}{SEt foo=$Q}
  3974.       would give a small 5 character window scrolling to support a 30
  3975.       character input.
  3976.  
  3977.             The ?S command takes a value between 1 and 80 - any other
  3978.       value will cause BATUTIL to exit with a syntax error.  With window
  3979.       sizes that are close to maximum value (or if you have moved the
  3980.       cursor prior to calling {SE foo=$?}), the edit window may wrap to
  3981.       the next line.  ?L will take values from 1 to 255.  If ?L is
  3982.       smaller than ?S then BATUTIL automatically adjust ?S down to the
  3983.       size of ?L.
  3984.  
  3985.             If you want to know the length of a string input by the user
  3986.       or which you'll need for some other reason [LEngth string] will
  3987.       return that length after metastring translation unless {$T -} is in
  3988.       effect.  An error level of 199 is returned if the string is 199
  3989.       characters or more in length.  Normally, LE is used with something
  3990.       requiring metastring translation, especially a $x variable.
  3991.  
  3992.             The LE command is kept for compatibility.  With BATUTIL 4.x,
  3993.       you can also get the length of a string with a $s command - see
  3994.       Section VI.2.
  3995.  
  3996.             The metastring $¿ (that's $ followed by ASCII 168) is just like
  3997.       $? except that what you type in is not echoed to the screen.  This
  3998.       makes it suitable for password entry.
  3999.  
  4000.             In addition to string input, you can force numeric input with
  4001.       $N.  The number will be between -1,000,000,000 and 1,000,000,000.
  4002.       The default is 0.
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.       Chapter V:ENVIRONMENTAL CONTROL                            Page 74
  4009.  
  4010.  
  4011.  
  4012.  
  4013.                         Documentation for BATUTIL, Version 4.0
  4014.  
  4015.  
  4016.       V.6 Using the File Pick List
  4017.             Metastrings: $F,$f
  4018.  
  4019.             BATUTIL lets you popup a file list from which the user can choose
  4020.       a file and you can have the filename chosen saved in the
  4021.       environment.  Within the set command, just use a $f or $F on the
  4022.       right side of an equal sign and a file list will popup.
  4023.             Arrows move the bar cursor by one space
  4024.             <PgUp> <PgDn> move up/down by one panel of 22 files
  4025.             <Home> <End>  move to the first/last file
  4026.       The list end with a listing of subdirectories and drives.  Hitting
  4027.       enter on a subdirectory will cause that subdirectory to be
  4028.       displayed and on a drive letter, will shift the display to the
  4029.       current directory on that drive.  Files show in lowercase,
  4030.       directories in uppercase and drives surrounded by [- -].
  4031.  
  4032.             Included in the list unless you are already in the root are,
  4033.       the parent directory indicated as ..\. <Enter> chooses that file and
  4034.       fills its full pathname in place of the $f.  The directory is stored
  4035.       in the variable FDIR with the provisos discussed in Section II.6.
  4036.       <Esc> exits with $f and FDIR replaced by the empty string.  If the
  4037.       user exits with <Enter>, RC is set to 0 and if with <Esc> to 2.
  4038.  
  4039.             Optionally, you can place a filespec in parentheses immediately
  4040.       after $f as in
  4041.             $f(A:d*.*)
  4042.       The filelist will then only list matching files.  All subdirectories
  4043.       and drives are listed.  Even if the drive or directory is illegal
  4044.       (for example a floppy without a disk or free drive letter!), the
  4045.       other legal disk drives will be listed to allow switching to them.
  4046.       The filespec appears at the top of filelist box.
  4047.  
  4048.             A scroll bar appears on the left of the filelist box and the
  4049.       slider shows the fraction of the list of the current cursor.
  4050.  
  4051.             In this version, a mouse is supported with the filelist.  A
  4052.       separate mouse cursor will appear if you have a mouse and {NMouse}
  4053.       hasn't been set.  The right button acts like <Esc>.  Left click on
  4054.       the list moves the cursor there and double left click moves and
  4055.       issues an <Enter>.
  4056.  
  4057.             Metastring processing is done inside $f primarily to allow for
  4058.       the use of $x.  Thus the following works as you'd expect:
  4059.             batutil {EC Enter filespec}{SEt foo=$Q foo=$f($x(foo))}
  4060.  
  4061.  
  4062.       Chapter V:ENVIRONMENTAL CONTROL                            Page 75
  4063.  
  4064.  
  4065.  
  4066.  
  4067.                         Documentation for BATUTIL, Version 4.0
  4068.  
  4069.  
  4070.             Only the first $f is expanded on the right side of an equal sign.
  4071.       However, within a single set command, $f's associated with distinct
  4072.       variables will each be processed.  While this capability is there,
  4073.       we recommend against normally using it as the user can get confused
  4074.       about there really being several commands.
  4075.  
  4076.             $f has changed some from Version 1.0 as we refine some design
  4077.       decisions.  Rather than exit with an error set for an illegal drive
  4078.       or file spec in (..), we show all valid drives.  Rather than use
  4079.       letters to switch, they appear on the file list much in the format of
  4080.       Windows.
  4081.  
  4082.  
  4083.       V.7 Saving and Loading the Environment to a File
  4084.             Commands: SAvenv, LOadenv, KIllenv
  4085.             Parameters: SAvenv and LOadenv take a filename with LOad allowing
  4086.                  an extra /m to merge; KIllenv takes a list of variables
  4087.                  to keep
  4088.  
  4089.             BATUTIL allows you to do automated bulk operations to the
  4090.       environment:
  4091.  
  4092.             - {SAvenv filename} will save a copy of the environment in the
  4093.       file "filename".  If the file already exists, you will asked
  4094.       confirmation to overwrite.  If the user responds N, then the error
  4095.       level is set to 199.
  4096.  
  4097.             -  {LOadenv filename} and {LOad filename /m} will load a
  4098.       previously saved environment.  The first command will completely
  4099.       replace the environment with the one in the file saving nothing
  4100.       from the prior environment.  The command with the /m will merge the
  4101.       saved environment with the current environment - variables which
  4102.       are in the current environment but not in the saved environment
  4103.       will be kept.  Variables which occur in both the current and saved
  4104.       environment will be assigned the value in the filename.
  4105.  
  4106.             - {KIllenv} will remove all strings from the current
  4107.       environment except for the COMSPEC string which BATUTIL will not
  4108.       remove (if you insist on removing it, use
  4109.             SET comspec=
  4110.       as a DOS command).  In addition you can save some specific
  4111.       environmental variables by including their names as parameters.
  4112.       For example
  4113.             batutil {KI path prompt}
  4114.  
  4115.  
  4116.       Chapter V:ENVIRONMENTAL CONTROL                            Page 76
  4117.  
  4118.  
  4119.  
  4120.  
  4121.                         Documentation for BATUTIL, Version 4.0
  4122.  
  4123.  
  4124.       would remove all non-DOS variables from the environment.
  4125.  
  4126.             The environment saved by the {SA} command is saved as an
  4127.       ASCII file with one variable per line.  You can edit it with any
  4128.       ASCII editor that will support lines which are long enough.  You
  4129.       can freely add lines but no line should have over 255 characters.
  4130.       Any line added must have the form
  4131.             VARNAME=value
  4132.       (without leading blanks) where VARNAME is all caps, and value is
  4133.       not an empty string.
  4134.  
  4135.             The KIllenv command is intended for use in third party batch
  4136.       files if used with care (but see below).  You can save the user's
  4137.       environment to a file, use KIllenv and later load the saved
  4138.       environment.  You can then use the environment for variable space
  4139.       while your batch file runs.  It is recommended that if you do this,
  4140.       you exercise several cautions:
  4141.             -  check for sufficient space without killing the environment
  4142.       and if there is sufficient space, don't save and kill.  You could
  4143.       also consider checking if the user has DOS 3.2 or later and get the
  4144.       larger environment by using command /c /e:1024 to rerun the batch
  4145.       file with a larger environment
  4146.             -  warn the user what you are about to do and give them the
  4147.       option of aborting the batch file.
  4148.             -  be sure to use SA and KI in the same command line as in
  4149.                   batutil {SA foo1}{KI}
  4150.       since a file error during the save operation will halt BATUTIL and
  4151.       so the KI command won't happen if the SA doesn't work.  Also,
  4152.       BATUTIL halts if the file exists and the user says not to
  4153.       overwrite.  Check for errorlevel 199
  4154.             -  Be sure to erase the saved environment file when your
  4155.       batch file ends to avoid giving the user a file he/she knows
  4156.       nothing about and to avoid problems if your batch file is rerun.
  4157.             -  Check for the existence of the filename you want to save
  4158.       for first and give the user more useful information than the
  4159.       general `File exists; Overwrite (Y/N)?' that BATUTIL provides.
  4160.  
  4161.             KIllenv is kept for compatibility and special purposes.
  4162.       Normally where you might want to use KIllenv with Version 1.0, you
  4163.       can instead use a combination of the {RC $} command and internal
  4164.       variables.
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.       Chapter V:ENVIRONMENTAL CONTROL                            Page 77
  4171.  
  4172.  
  4173.  
  4174.  
  4175.                         Documentation for BATUTIL, Version 4.0
  4176.  
  4177.  
  4178.       V.8  Batch File Path Control
  4179.             Commands: ADdpath, DElpath
  4180.             Parameters: list of paths separated by space, comma or
  4181.       semicolon - $p and $P are processed
  4182.  
  4183.             BATUTIL will let you easily add additional directories to
  4184.       your DOS search path and delete directories.  The syntax is
  4185.             batutil {AD dir1 dir2 ...}
  4186.             batutil {DE dir1 dir2 ...}
  4187.       The keyword ADdpath or DElpath and the directories in the list may
  4188.       be separated from one another by any combination of spaces,
  4189.       semicolons, and commas.
  4190.  
  4191.             ADdpath can be compared with what you can do in a DOS batch
  4192.       file by saying
  4193.             set path=%path%dir1;dir2;
  4194.       ADdpath allows paths over 127 characters (actually, if you really
  4195.       want a path over 127 characters, you should consider changing your
  4196.       disk setup - too many directory entries in a path will slow DOS
  4197.       down), the $p,$P translation as discussed below and it won't let
  4198.       you duplicate an entry in the path list (so long as you don't try
  4199.       to do something like C:\bin and \bin which it will allow).
  4200.  
  4201.             DElpath will search the path and remove the specified
  4202.       directories if found in the path.  The string listed in the command
  4203.       must agree (except for case) with a directory name in the path.
  4204.  
  4205.             ADdpath and DElpath do not do metastring translation except
  4206.       for $p and $P.  For example, the following batch files would add
  4207.       and subtract the current directory from the DOS path
  4208.  
  4209.             addpath.bat
  4210.               batutil {AD $p}
  4211.  
  4212.             delpath.bat
  4213.               batutil {DE $p}
  4214.  
  4215.       A typical application of these commands would be if a program
  4216.       silly.com requires that its directory C:\rudeprog be in the path
  4217.       when it is run.  A batch file to do this would read:
  4218.             batutil {AD C:\rudeprog}
  4219.             C:\rudeprog\silly
  4220.             batutil {DE C:\rudeprog}
  4221.  
  4222.  
  4223.  
  4224.       Chapter V:ENVIRONMENTAL CONTROL                            Page 78
  4225.  
  4226.  
  4227.  
  4228.  
  4229.                         Documentation for BATUTIL, Version 4.0
  4230.  
  4231.  
  4232.             BATUTIL has no problem reading in paths which don't end with
  4233.       a semicolon but the paths that it writes out always have a
  4234.       semicolon at the end.
  4235.  
  4236.             The AD and DE commands return information in the errorlevel
  4237.       and/or variable RC.  AD tells you the number of directories actually
  4238.       added to the path (since entries are not duplicated, this may be
  4239.       smaller than the number listed) and DE the number deleted (since
  4240.       you may have listed a directory not in the path, this may be
  4241.       smaller the number listed).
  4242.  
  4243.  
  4244.       V.9 Direct Editing of the Path
  4245.             Command: PAthedit, NBeep
  4246.  
  4247.             batutil {PAthedit}
  4248.       brings up an interactive editor which allows you to edit your path.
  4249.       Up to 17 directories can be displayed at once; with more, you can
  4250.       use the arrow keys to scroll or PgUp/PgDn to move by 10 directories
  4251.       at a time.  One of the directories is highlighted.  <Up>, <Down>,
  4252.       <Home>, <End> do the obvious thing to the highlight.  <Enter> picks out
  4253.       that entry and lets you edit it using the line editor discussed in
  4254.       Section I.5.  Ctrl-D will delete the directory the cursor is on from
  4255.       the path list (but not change the actually on disk directory) and Ctrl-
  4256.       A will let you add a new path.
  4257.  
  4258.             The order of the directories in your path matters somewhat in
  4259.       that DOS searches in the specified order (in particular, if you
  4260.       have a RAM disk, put its directories before the any others).  Alt-T
  4261.       moves the highlighted directory to the Top of the list and Alt-B to
  4262.       the Bottom.
  4263.  
  4264.             All these changes only effect the in memory copy of the path
  4265.       but not the true path as stored in the environment.  When you press
  4266.       <Esc> to exit, if you have made any changes, then BATUTIL will
  4267.       offer to save them to the true path as stored in the DOS
  4268.       environment.
  4269.  
  4270.             There are various places that BATUTIL will beep and display a
  4271.       message to warn you; for example, when you exit and are asked if
  4272.       you want to save the edited environment.  If you don't like beeps,
  4273.       the NBeep command will turn off the beeps for the PAthedit and
  4274.       EDitenv commands.  You could call up the PAthedit command with
  4275.             batutil {NB}{PA}
  4276.  
  4277.  
  4278.       Chapter V:ENVIRONMENTAL CONTROL                            Page 79
  4279.  
  4280.  
  4281.  
  4282.  
  4283.                         Documentation for BATUTIL, Version 4.0
  4284.  
  4285.  
  4286.       or can place {NB} in the BATUTIL environment string.
  4287.  
  4288.  
  4289.       V.10 Direct Editing of the Environment
  4290.             Command: EDitenv
  4291.             Parameter: optional name or $
  4292.  
  4293.             batutil {EDitenv}
  4294.       brings up an edit module for the full environment very similar to
  4295.       that discussed in the last section.  The main difference are the
  4296.       following:
  4297.             - Total and free environment space is listed on the bottom
  4298.                 line
  4299.             - Only the first 80 characters of each environment string is
  4300.                 displayed
  4301.             - Each environmental variable has two pieces: the name of the
  4302.                 variable and its value stored as
  4303.                    name=value
  4304.       <Enter> allows you to edit the value while ^<Enter> the name.
  4305.  
  4306.             While Ctrl-T/B are active, the order of variables in the
  4307.       environment does not normally make any difference.
  4308.  
  4309.             You can also follow ED with a single variable name.  If the
  4310.       variable is in the environment, that value is brought into the line
  4311.       editor for editing.  If it is a new variable you get to use the
  4312.       line editor to define it.  NBeep applies to this module also.  You
  4313.       are limited to editing environments with no more than 511 strings
  4314.       (each with no more than 255 bytes).
  4315.  
  4316.             The command
  4317.                 {EDitenv $}
  4318.       brings up an interactive editor for BATUTIL's 32 internal variables.
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.       Chapter V:ENVIRONMENTAL CONTROL                            Page 80
  4333.  
  4334.  
  4335.  
  4336.  
  4337.                                  Chapter VI:BUSIC
  4338.  
  4339.       VI.1 Internal Variables
  4340.             Commands: PUt, RC, $1,..,$0,$é,..,$ò (implied SEt)
  4341.             Parameters: PUt takes + or -.  RC takes $ or nothing.
  4342.             Metastrings: $1,..,$0,$é,..,$ò,$r,$%
  4343.  
  4344.  
  4345.             BATUTIL includes a full blown language for manipulating your
  4346.       'batch' files.  In essence, since these commands are to BATUTIL and
  4347.       not DOS' batch processor, they aren't in batch files although careful
  4348.       use of the INclude command as explained in Section I.7 will allow you
  4349.       to place them in your .bat file.
  4350.  
  4351.             We've dubbed the language BUSIC for BatUtil's Standard
  4352.       Instructions and Commands.  In this section, we'll describe the
  4353.       internal variables which supplement the use of the environment and in
  4354.       the next three manipulation of strings, numbers and dates via
  4355.       metastring translation.  Section VI.5 deals with reading and writing
  4356.       files and VI.6-VI.10 with the reserved words in the language.
  4357.       Section VI.11 describes the internals of the how the language is
  4358.       interpreted to help you understand some of the output of the trace
  4359.       command described in Section VI.12.  Section VI.13 isn't really about
  4360.       the language but rather about peeks and pokes to memory and ports, a
  4361.       subject we thought of interest mainly to the same users who wanted to
  4362.       deal with advanced aspects of BUSIC.
  4363.  
  4364.             BATUTIL understands 32 internal variables of which 30 are user
  4365.       modifiable.  They are denoted $1,...,$9,$0 for the ten you'll use
  4366.       commonly and 20 which are $ followed by an ASCII character from 130
  4367.       to 149.  These characters can be entered in many editors by holding
  4368.       done the Alt key and typing the three numbers on the keypad.  They'll
  4369.       appear on screen as
  4370.             é,â,ä,à,å,ç,ê,ë,è,ï,î,ì,Ä,Å,É,æ,Æ,ô,ö,ò
  4371.       so for example $å is the variable associate to ASCII 134.
  4372.  
  4373.             As explained in the last two chapters you can assign values to
  4374.       these variables with the SEt command (or via an implied SEt since any
  4375.       line starting with $ followed by 1,..,0,é,..,ò has an implied SEt
  4376.       added) and you can get out the current value in any string that gets
  4377.       metastring translation such as ECho or the right side of a SEt
  4378.       command.
  4379.  
  4380.             The 31st variable, indicated by $r normally has the last value
  4381.       set by any command that the environmental variable RC; indeed, by
  4382.       default, $r is the same as $x(rc).  However, at times you don't want
  4383.       the environment to be used, you can use the command
  4384.  
  4385.  
  4386.       Chapter VI:BUSIC                                           Page 81
  4387.  
  4388.  
  4389.  
  4390.  
  4391.                         Documentation for BATUTIL, Version 4.0
  4392.  
  4393.  
  4394.             {RC $}
  4395.       which tells BATUTIL that whenever it is about to set the value of RC,
  4396.       it should instead set the internal value stored in $r and then $r
  4397.       references this internal variable.
  4398.  
  4399.             $% stores the first file error found by BATUTIL and is
  4400.       discussed further in Section VI.5.
  4401.  
  4402.             BATUTIL stores the internal variables in its memory while it is
  4403.       running but when it exits and gives up its memory to DOS, the values
  4404.       are gone.  To save the values in memory, you need to store them in
  4405.       the environment and recovered them when you next restart BATUTIL.
  4406.       The {PUt +} command places all the non-empty values in the
  4407.       environment so that for example it might add
  4408.             $1=8
  4409.             $2=foobar
  4410.       and the {PUt -} command looks for such strings in the environment,
  4411.       transfers the values to the internal table and deletes the values
  4412.       from the environment.
  4413.  
  4414.             Note that using $R will change $9 and that the variables $7, $8
  4415.       and $9 are used a "hidden" parameters for some commands.
  4416.  
  4417.             All these variables are of string type but the string may
  4418.       happen to be one describing a number - see Section VI.3.  The maximum
  4419.       length of an string stored in one of these variables is 255
  4420.       characters.
  4421.  
  4422.             You can interactively edit the internal variables using
  4423.                 ED $
  4424.  
  4425.  
  4426.       VI.2 String Manipulation
  4427.  
  4428.             Metastring: $s(2 to 4 allowed parameters)
  4429.  
  4430.             BATUTIL allows you to manipulate strings of characters with the
  4431.       $s metastring (don't confuse with $S=space).  $s must be followed by
  4432.       a ( followed by 2,3 or 4 parameters separated by commas.  The first
  4433.       is a single letter which describes the action, the second the string
  4434.       to be analyzed and the final an additional parameter required in some
  4435.       cases.  The string in position 2 cannot contain any of the parameters
  4436.       comma, {}[]) but since metastring translation is done you could use
  4437.       that to get such characters in.  Normally metastring translations are
  4438.  
  4439.  
  4440.       Chapter VI:BUSIC                                           Page 82
  4441.  
  4442.  
  4443.  
  4444.  
  4445.                         Documentation for BATUTIL, Version 4.0
  4446.  
  4447.  
  4448.       done on the additional parameters (the exception is the subcommand
  4449.       #).  So the syntax is
  4450.             $s(subcommand,string,additional params)
  4451.  
  4452.            Here is a summary of subcommands:
  4453.  
  4454.            Subcommand  Purpose                  Additional parameter(s)
  4455.             U           Uppercase                  NONE
  4456.             L           Lowercase                  NONE
  4457.             S           Size                       NONE
  4458.             P           Position                   substring
  4459.             C           Copy                       start, length
  4460.             D           Delete                     start, length
  4461.             I           Insert                     substring, position
  4462.             W           Word                       word number (0=total)
  4463.             T           Trim                       NONE
  4464.             F           Format                     L,R,C + length
  4465.             #           count                      character
  4466.  
  4467.             Here are the details (the subcommand can be upper or
  4468.       lowercase):
  4469.             $s(U,string) returns the string all uppercase
  4470.             $s(L,string) returns the string all lowercase
  4471.             $s(S,string) returns the number of characters in the string
  4472.             $s(P,string,substring) returns the position of the first
  4473.                  location of substring in string (0 if not found)
  4474.             $s(C,string,start,length) returns a string of size length
  4475.                  beginning at position start in string (if the string
  4476.                  has total size less than start+length-1, then the returned
  4477.                  string has length size(string)-start+1)
  4478.             $s(D,string,start,length) returns the string with length
  4479.                  characters deleting starting at position start
  4480.             $s(I,string,string1,start) inserts string1 into string with
  4481.                  the first character of string1 in position start.
  4482.             $s(W,string,num) returns word number num in string unless num
  4483.                  is 0 in which case it returns the number of words in
  4484.                  string
  4485.             $s(T,string) returns string with leading and trailing blanks
  4486.                  deleted
  4487.             $s(F,string,X,length) with X=L,R or C returns a string of
  4488.                  size length or more with string padded with blanks in
  4489.                  front and/or back so that string is left/right/center
  4490.                  justified
  4491.             $s(#,string,cha) returns the number of times the character cha
  4492.  
  4493.  
  4494.       Chapter VI:BUSIC                                           Page 83
  4495.  
  4496.  
  4497.  
  4498.  
  4499.                         Documentation for BATUTIL, Version 4.0
  4500.  
  4501.  
  4502.                  occurs in string
  4503.  
  4504.             Here are examples.  To indicate spaces we will put the result
  4505.       in quotes although they are NOT in the actual returned string:
  4506.             $s(U,Now is the time) becomes "NOW IS THE TIME"
  4507.             $s(L,Now is the time) becomes "now is the time"
  4508.             $s(S,Now is the time) becomes "15"
  4509.             $s(P,Now is the time,ti) becomes "12"
  4510.             $s(C,Now is the time,10,5) becomes "e tim"
  4511.             $s(C,Now is the time,10,25) becomes "e time"
  4512.             $s(D,Now is the time,10,4) becomes "Now is thme"
  4513.             $s(I,Now is the time,hi ,10) becomes "Now is thhi e time"
  4514.             $s(W,Now is the time,3) returns "the"
  4515.             $s(W,Now is the time,0) returns "4"
  4516.             $s(T,   Now is the time  ) returns "Now is the time"
  4517.             $s(F,Now is the time,L,19) returns "Now is the time    "
  4518.             $s(F,Now is the time,R,19) returns "    Now is the time"
  4519.             $s(F,Now is the time,C,19) returns "  Now is the time  "
  4520.             $s(#,Now is the time,i) returns "2"
  4521.  
  4522.  
  4523.       VI.3 Arithmetic
  4524.  
  4525.             Commands: ++, --, ISnum
  4526.             Parameters: $1,...,$0,$é,...,$ò or environmental variable for
  4527.                            ++ and --
  4528.                         string or string min max for ISnum
  4529.  
  4530.             Metastring: $V
  4531.  
  4532.             Because BATUTIL does not distinguish between string variables
  4533.       and numeric variables, it needs to know when it sees a + whether you
  4534.       intend it as just a character or an arithmetic operation.  When it
  4535.       sees $1+$2 and $1 cannot be interpreted as a number, it can't be sure
  4536.       if it's an error or not.  So you must use a special metastring $V
  4537.       (not to be confused with $v=current drive) to indicate arithmetic
  4538.       operations.
  4539.  
  4540.             Whenever BATUTIL finds a $V in a place it does metastring
  4541.       translation (like ECho, SEt, MEnu, etc), it looks for a ( immediately
  4542.       following it and reads to the matching ) and takes the ... in $V(...)
  4543.       and eValuates it (or finds its Value) using the following operations:
  4544.                     /    integer division, e.g. 15/7 = 2
  4545.                     \    mod (division remainder) e.g. 15\7 = 1
  4546.  
  4547.  
  4548.       Chapter VI:BUSIC                                           Page 84
  4549.  
  4550.  
  4551.  
  4552.  
  4553.                         Documentation for BATUTIL, Version 4.0
  4554.  
  4555.  
  4556.                     **   power
  4557.                     *    multiplication
  4558.                     +    addition
  4559.                     -    subtraction (also allowed for negative numbers)
  4560.       This ordering describes the order in which it does operations so
  4561.       that, for example, multiplication is done before addition and
  4562.       $V(3+2*4) is 11.  BATUTIL understands nested parentheses which can be
  4563.       used to affect the order of precedence so $V((3+2)*4) is 20.
  4564.  
  4565.             BATUTIL only understand integers and never deals with reals or
  4566.       fractions.  By integer division, we mean the following: if m and n are
  4567.       both positive, then m/n is that number q so that
  4568.             m = qn + r
  4569.       with r in the set 0,1,2,..,n-1.  For general m,n if sgn(x) is the
  4570.       sign of x and |x| is its absolute value then
  4571.             m/n = sgn(m)*sgn(n)*|m|/|n|
  4572.  
  4573.             m\n is the mathematically correct modulo function, so for any m
  4574.       and n, it is the r in 0,1,..,|n|-1 with
  4575.             m = qn + r
  4576.       Note that for general m and it may not be true that
  4577.             m = n*(m/n) + m\n
  4578.       although this is true if m and n are positive.
  4579.  
  4580.             Generally, BATUTIL will exit with a "number too large or syntax
  4581.       error" error message if the initial or final numbers are more than
  4582.       1,000,000,000 although occasionally numbers up to 2,147,483,647 are
  4583.       allowed without an error message.
  4584.  
  4585.             Other error messages that can occur include:
  4586.                illegal character:  Note that a comma as in 1,000 is illegal
  4587.                parenthesis mismatch: for example, $V((2+3*8)
  4588.                spacing error: for example, $V(2 3) but $V(2 + 3) is OK
  4589.                operator missing: for example $V(2(3+4))
  4590.                illegal negative power
  4591.                division by zero
  4592.  
  4593.             BATUTIL understands two shorthand commands for incrementing or
  4594.       decrementing a number, name ++ and --.  ++ XXX is interpreted to mean
  4595.             SEt XXX=$V(XXX+1)
  4596.       if XXX is one of the thirty built in variables.  Otherwise it is
  4597.       interpreted to mean
  4598.             SEt XXX=$V($x(XXX)+1)
  4599.       and similarly for --.
  4600.  
  4601.  
  4602.       Chapter VI:BUSIC                                           Page 85
  4603.  
  4604.  
  4605.  
  4606.  
  4607.                         Documentation for BATUTIL, Version 4.0
  4608.  
  4609.  
  4610.             Because BATUTIL exits if $V encounters a non-numeric string,
  4611.       you may want to be sure that a variable has a numeric value.  In
  4612.       addition you may want to be sure that a number falls inside a given
  4613.       range.  The ISnum command is intended to check this.  The syntax is
  4614.       either
  4615.             ISnum string
  4616.       or
  4617.             ISnum string min max
  4618.       The first command returns a value of 0 if the string is a number
  4619.       within the range -2,147,483,647...2,147,483,647 and 3 otherwise.
  4620.  
  4621.             The second requires that min and max be numbers in this allowed
  4622.       range from -2,147,483,647 to 2,147,483,647 with min no more than max
  4623.       (or else BATUTIL exits with an error).  It returns the values
  4624.             0 if the string is number between min and max (inclusive)
  4625.             1 if the string is a number greater than max (but no more than
  4626.                 2,147,483,647)
  4627.             2 if the string is a number less than min (but not less than
  4628.                 -2,147,483,647)
  4629.             3 if it is not a number or not in the range
  4630.                 -2,147,483,647...2,147,483,647
  4631.  
  4632.  
  4633.       VI.4 Date Arithmetic
  4634.  
  4635.             Metastrings: $J(...), $M(...), $D(...), $Y(...), $W(...),
  4636.       $E(...)
  4637.  
  4638.             BATUTIL understands four forms for the date, three for input
  4639.       and three for output (with an overlap of two) - metastring
  4640.       translations freely transform from an input form to an output form.
  4641.  
  4642.             The three formats for input are:
  4643.                 - MM-DD-YY or MM/DD/YY  apologies to Europeans for using
  4644.                     the American convention of MM/DD not DD/MM
  4645.                 - the number of days since 12/31/79 with 1/1/80=1
  4646.                 - the date assigned to a file name
  4647.  
  4648.             The three formats for output are:
  4649.                 - MM/DD/YY as above
  4650.                 - days since 12/31/79 as above
  4651.                 - the date and weekday in English, e.g. Sunday, September
  4652.                     15, 1991
  4653.  
  4654.  
  4655.  
  4656.       Chapter VI:BUSIC                                           Page 86
  4657.  
  4658.  
  4659.  
  4660.  
  4661.                         Documentation for BATUTIL, Version 4.0
  4662.  
  4663.  
  4664.             The six date connected metastrings $J, $M, $D, $Y, $W, $E
  4665.       correspond to the components of the output types.  They take an
  4666.       argument in (...) or if an argument is missing, they use today.  The
  4667.       arguments correspond to the three input type.  BATUTIL first looks
  4668.       for an integer between 1 and 7305 since the number of days from
  4669.       12/31/79 to 12/31/99 is 7305.  This version of BATUTIL only
  4670.       understand dates in that range (contact us if you'd like to see this
  4671.       restriction removed).  It then looks to interpret the argument in the
  4672.       form MM/DD/YY or MM-DD-YY and if that fails, it will use the argument
  4673.       for a filename.  YY could be either 91 or 1991.  If you make an error
  4674.       like write 9\15\91, you'll get an invalid pathname error since the
  4675.       last thing that BATUTIL will try is to take that string as a
  4676.       filename.
  4677.  
  4678.             The metastrings are the following:
  4679.                 $J = number of days since 12/31/79 in the Julian calendar
  4680.                 $M = month
  4681.                 $D = day
  4682.                 $Y = year
  4683.                 $W = weekday
  4684.                 $E = date in English
  4685.  
  4686.             For example
  4687.                 $J(9/15/91) = 4276
  4688.                 $M(4276)    = 09
  4689.                 $D(4276)    = 15
  4690.                 $Y(4276)    = 91
  4691.                 $W(4276)    = Sunday
  4692.                 $E(4276)    = September 15, 1991
  4693.  
  4694.             The use of conversion from MM/DD/YY and filename to English and
  4695.       weekday should be clear but why care about $J and that form of date?
  4696.       Simple - to do date arithmetic and date comparisons.  If you want to
  4697.       know the date 50 days from now use $E($V(50+$J)).  If you want to
  4698.       know the number of days between 1/24/81 and 4/16/91 try
  4699.             $V($J(4/16/91) - $J(1/24/81))
  4700.  
  4701.             If you want to list all files at no more than 5 days old, you'd
  4702.       use:
  4703.           for $1 in (*.*) do if $J($1) > $V($J - 5)  then echoln $1
  4704.  
  4705.       [NOTE: At the DOS command line remember to use $g not >.]
  4706.  
  4707.  
  4708.  
  4709.  
  4710.       Chapter VI:BUSIC                                           Page 87
  4711.  
  4712.  
  4713.  
  4714.  
  4715.                         Documentation for BATUTIL, Version 4.0
  4716.  
  4717.  
  4718.       VI.5 Reading from and Writing to Files
  4719.             Commands: >, $Rtranslate, $Wtranslate, IOerror
  4720.             Parameters: +/- for $R, $W and IO
  4721.             Metastrings: $R(...), $R(con), $R, $%
  4722.  
  4723.             BATUTIL can read and write to text files.  The commands to
  4724.       write to a file are ONLY valid in a INclude set of commands and
  4725.       involve expanding the ECho command.  Reading from a file involves the
  4726.       $R command.  You can also read from the screen.
  4727.  
  4728.             The first time $R is used after a given time that BATUTIL is
  4729.       loaded, it is REQUIRED that a filename follow the $R in the form
  4730.             $R(filename)
  4731.       There are two variants on this syntax.  If the filename is proceeded
  4732.       by a + sign, the file is chosen for reading but the first line is not
  4733.       actually read.  If the first letter is a - sign, the file reading is
  4734.       begun again from line 1.  If you want to do both, that is return the
  4735.       read pointer to the first line but not actually read a line, then use
  4736.       +-.
  4737.  
  4738.             Each time a $R appears without a (..) after the initial
  4739.       $R(...), the next lines of the file is read.  The line number of the
  4740.       last line read is normally stored in the variable $9.  You can change
  4741.       the next line read by changing $9 since each $R read reads line
  4742.       number $9 + 1.
  4743.  
  4744.             There are two times that $R returns an empty string.  If it has
  4745.       the form $R(+filename) or if the end of the file has already been
  4746.       reached.  If a line has more than 255 characters, only the first 255
  4747.       characters are read in for $R.
  4748.  
  4749.             If a $R read is successful and the last line read is not the
  4750.       end of the file, then the internal variable $% is set to 0.  If the
  4751.       end of the file has been reached, then $% is set to 1.  Thus, for
  4752.       example
  4753.             $1=$R(+somefile)
  4754.             REPEAT
  4755.                 $1=$R
  4756.             UNTIL $%=1
  4757.             echo the file has $9 lines
  4758.       would count the number of lines in a file.
  4759.  
  4760.             Normally, if there is a file error in attempting to read from a
  4761.       file, BATUTIL exits with an error message but if you want to trap
  4762.  
  4763.  
  4764.       Chapter VI:BUSIC                                           Page 88
  4765.  
  4766.  
  4767.  
  4768.  
  4769.                         Documentation for BATUTIL, Version 4.0
  4770.  
  4771.  
  4772.       these errors, you can prevent the exit by using the command
  4773.             IOerror -
  4774.       (and you can restore the default behavior with IO +).  This prevents
  4775.       exits for file reads and writes via $R and echo only.  Once IOerror
  4776.       exits are turned off, the first file error on read is indicated in
  4777.       the variable $% with values:
  4778.                 2: file not found
  4779.                 9: invalid path
  4780.               230: drive not ready
  4781.               231: other file error
  4782.  
  4783.             By default, metastring translation is OFF for file reads but
  4784.       you can turn it on with the command
  4785.             $Rtranslate +
  4786.  
  4787.             BATUTIL acts specially if the file indicated for a $R
  4788.       metastring is called CON.  In that case the variables $7, $8, $9 are
  4789.       used.  $9 must be set and have a value in the range 1 to 255 - it
  4790.       indicates the number of characters to be read.  $7 sets the screen
  4791.       row and $8 the column.  If they are empty, they are interpreted to be
  4792.       0.  The there is an explicit + or - or the value is 0, the row and/or
  4793.       column are relative to the current cursor position - otherwise they
  4794.       are absolute.  For example, the following set of command would read
  4795.       the line before the current one, delete leading and trailing blanks
  4796.       and store the result in the variable $1:
  4797.             #T C
  4798.             $9=$r
  4799.             $7=-1
  4800.             $8=1
  4801.             $1=$R(con)
  4802.             $1 = $s(T,$1)
  4803.       Recall that #T C returns the number of columns on the monitor.
  4804.  
  4805.             In an INcluded set of commands, you can write to a file by
  4806.       using ECho and the > sign.  That is
  4807.             EC some string> somefile
  4808.       would delete any file of that name and write the file with the string
  4809.       in it (after metastring translation).  If >> were used instead of >,
  4810.       then BATUTIL will append just as DOS does.  If the filename is
  4811.       replaced by the symbol *, then the last filename used is used again
  4812.       and append is automatically on.
  4813.  
  4814.             If the first symbol after a single > is a ? and the file exists
  4815.       then BATUTIL displays a message:
  4816.  
  4817.  
  4818.       Chapter VI:BUSIC                                           Page 89
  4819.  
  4820.  
  4821.  
  4822.  
  4823.                         Documentation for BATUTIL, Version 4.0
  4824.  
  4825.  
  4826.             File exists: filename
  4827.             <A>ppend, <O>verwrite, <C>ancel?
  4828.  
  4829.             A CR/LF is automatically added to the end of any line sent to a
  4830.       file with > or >> so the ln in echoln would be ignored in this case.
  4831.       But explicit $_ are translated.
  4832.  
  4833.             While metastring translation is ON for file writes, you can
  4834.       turn them off with
  4835.             $Wtranslate -
  4836.  
  4837.             The valid values for $% on write errors are
  4838.                     9: invalid path
  4839.                     5: file is read only
  4840.                   230: drive not ready
  4841.                   231: other file error
  4842.  
  4843.  
  4844.       VI.6 BUSIC Summary and Overview
  4845.  
  4846.             BUSIC proper has eight commands.  Two - GOto and LAbel have
  4847.       minimal truncations - but the other six IF, WHILE, CALL, FOR, REPEAT
  4848.       and CASE do not and must appear in full (although they are case
  4849.       insensitive).  In addition the language has several keywords which
  4850.       don't appears as commands (i.e. at the start of a line and causing
  4851.       action) - BEGIN, END, RET, UNTIL, ENDCASE, ELSE - they also must
  4852.       appear in full but are case insensitive.
  4853.  
  4854.             Three of the commands - IF, WHILE, REPEAT concern comparison
  4855.       strings with the same syntax as the HALTIF command of Version 1.0.
  4856.       That is the comparison string first has metastring translation and
  4857.       then the characters >, < or = are scanned for the strings on each
  4858.       side are compared.  If both strings can be interpreted as numbers up
  4859.       to 2,147,483,647 in absolute value, the compassion is done that way,
  4860.       otherwise as strings.
  4861.  
  4862.             For numbers, the meaning of < and > is clear.  For two strings,
  4863.       S1 and S2, we say S1 < S2 if length(S1) < length(S2) or if the
  4864.       lengths are equal and the strings are equal up to a point where the
  4865.       character in S1 comes before the one in S2 in the ASCII table (that
  4866.       is space is smallest, then number, then caps and then lower case).
  4867.  
  4868.             In this version, AND and OR are not supported.  If the first
  4869.       character in the string is ~ then the negative is taken of the string
  4870.  
  4871.  
  4872.       Chapter VI:BUSIC                                           Page 90
  4873.  
  4874.  
  4875.  
  4876.  
  4877.                         Documentation for BATUTIL, Version 4.0
  4878.  
  4879.  
  4880.       without ~.  Because of the metastring translation, you can use $g and
  4881.       $l for > and <; indeed, you must on the DOS command line since > and
  4882.       < will reinterpreted as redirection commands.
  4883.  
  4884.             In brief, the syntax is
  4885.  
  4886.               IF compare THEN thencmd ELSE elsecmd
  4887.  
  4888.               WHILE compare DO command
  4889.  
  4890.               FOR $A= start to stop DO command   ($A is one of $0,...,$9)
  4891.  
  4892.               REPEAT
  4893.                several commands
  4894.               UNTIL compare
  4895.  
  4896.               CASE string OF
  4897.                 poss1:cmds
  4898.                 poss2:cmds
  4899.                 ....
  4900.                 else: cmds
  4901.               ENDCASE
  4902.  
  4903.               LA labelname
  4904.  
  4905.               GO labelname
  4906.  
  4907.               CALL labelname
  4908.  
  4909.             The DO in WHILE and FOR and the OF in CASE are optional.  ELSE is
  4910.         optional in IF.  Details are discussed in separate sections below.
  4911.  
  4912.             The thencmd and elsecmd in an IF and the commands in FOR and
  4913.       WHILE can become several commands with BEGIN/END as in
  4914.             FOR $1=1 to 10 BEGIN
  4915.               $2=$v($1**2)
  4916.               $3=$v($1**3)
  4917.               ec The square of $1 is $2 and its cube is $3.
  4918.             END
  4919.       Commands must be on separate lines or separated by [] as usual.
  4920.       BEGIN must be on the same line as IF, FOR or WHILE.  The END should
  4921.       be on a line by itself unless followed by an ELSE.
  4922.  
  4923.  
  4924.  
  4925.  
  4926.       Chapter VI:BUSIC                                           Page 91
  4927.  
  4928.  
  4929.  
  4930.  
  4931.                         Documentation for BATUTIL, Version 4.0
  4932.  
  4933.  
  4934.             REPEAT/UNTIL has an implied BEGIN/END and you should not use an
  4935.       explicit one.  Each cmd after a case possibility can be multiple.
  4936.       There is also a BEGIN/END implied.
  4937.  
  4938.  
  4939.       VI.7 LABELS, GOTO and CALL
  4940.  
  4941.             Commands: LAbel, GOto, CALL
  4942.             Keywords: RET paired to LAbel on a CALL
  4943.  
  4944.             BATUTIL program flow is controlled with BATUTIL labels (not to
  4945.       be confused with batch file labels which start with : and are used by
  4946.       the command file reading routines in BATUTIL).  The syntax is
  4947.             LAbel labelname
  4948.       where as usual LAbel means that LA is the minimal truncation.
  4949.  
  4950.             Labels are not case sensitive and can include any characters
  4951.       except for [ ] { }.  Spaces are allowed in the middle of a label but
  4952.       leading and trailing spaces are removed.  Labels may be up to 100
  4953.       characters although obviously, you'll normally want labels of no more
  4954.       than 10 or 12 characters.  Labels over 100 characters will not
  4955.       produce an error and may work but there could be unexpected behavior.
  4956.       Metastring translation does NOT take place when the LA command is
  4957.       evaluated.
  4958.  
  4959.             When LA commands are reached, no action is taken - that is just
  4960.       like batch files, those lines are skipped.  When a label is called by
  4961.       a GOto or CALL command, all commands in memory are searched but
  4962.       labels in sections of code that are to be entered with an INclude
  4963.       command are only searched if that INclude command has been acted upon
  4964.       already.  Sections of code that are issued via an INclude command
  4965.       which is part of a CALL, REPEAT or BEGIN/END pair are removed from
  4966.       memory when that CALL, REPEAT or BEGIN/END is over.
  4967.  
  4968.             Two sets of labels have special meaning: labels which start
  4969.       with BATUTIL followed by extra characters are used internally by
  4970.       BATUTIL and you should avoid them.  The label ELSE has special
  4971.       meaning.  During the processing of GOto and CALL commands, if a label
  4972.       is not found, then the label ELSE is searched for and GOto or CALL
  4973.       control is passed there.
  4974.  
  4975.             Labels are searched for in the current loop or BEGIN/END action
  4976.       (in the current command level as discussed in Section 11) and then
  4977.       successively up through nested loops until the main set of commands
  4978.  
  4979.  
  4980.       Chapter VI:BUSIC                                           Page 92
  4981.  
  4982.  
  4983.  
  4984.  
  4985.                         Documentation for BATUTIL, Version 4.0
  4986.  
  4987.  
  4988.       are searched for.  This means if you have an ELSE label as part of a
  4989.       BEGIN/END set of statements as well as an ELSE label which appears
  4990.       earlier in the command list, then upon a label not found error,
  4991.       control will go to the first ELSE when not in the BEGIN/END chain and
  4992.       the second ELSE when in the BEGIN/END chain.  Except for this use of
  4993.       ELSE labels, we suggest avoiding duplicate label names.
  4994.  
  4995.             The syntax for a GOto command is
  4996.                 GOto labelname
  4997.       Metastring translation is done on this labelname so a command after a
  4998.       menu choice
  4999.                 GO menu$r
  5000.       will work the way you'd expect.  When a GO command is reached, script
  5001.       flow passes to the command following the corresponding label.
  5002.  
  5003.             There are several special labelnames which cause special
  5004.       behavior in the context of a GOto command:
  5005.             GOto HALT           will exit BATUTIL with errorlevel set to 0
  5006.             GOto HALTxxx        will exit with errorlevel xxx where xxx
  5007.                                         is in the range 0 to 255
  5008.             GOto EXIT           will exit the current CALL, FOR loop, etc
  5009.                                         technically go down a command level
  5010.             GOto EXITxx         will go down xxx command levels where xxx is
  5011.                                         in the range 1-10
  5012.  
  5013.             The CALL command is used for subroutines.  Its syntax is
  5014.                 CALL labelname
  5015.       It searches for a label and also turns control over to the command
  5016.       following the label. But it remembers the location of the CALL.  When
  5017.       a RET command is encountered, BATUTIL returns to the command
  5018.       following the CALL.
  5019.  
  5020.             Nested CALLs are allowed limited only by memory (we've found
  5021.       typical nesting limits are 30-40 levels deep which should suffice
  5022.       unless you have a logic flaw).  If memory runs out, an error message
  5023.       is issued and BATUTIL exits.
  5024.  
  5025.             BATUTIL actually looks for the matching RET at the time the
  5026.       CALL begins and exits with an error if none is found.  If a RET is
  5027.       encountered in the middle of BATUTIL processing except as part of a
  5028.       CALL, then you'll get an Unmatched RET error.  For this reason,
  5029.       you'll normally want to place all subroutines at the start or at the
  5030.       end of your code and jump over them.  The start mode has the form:
  5031.             GO code
  5032.  
  5033.  
  5034.       Chapter VI:BUSIC                                           Page 93
  5035.  
  5036.  
  5037.  
  5038.  
  5039.                         Documentation for BATUTIL, Version 4.0
  5040.  
  5041.  
  5042.             LA sub1
  5043.             .....   {subrountine 1 code}
  5044.             RET
  5045.             LA sub 2
  5046.             ....    {subrountine 2 code}
  5047.             RET
  5048.             ....    {other subrountine  code}
  5049.             RET
  5050.             LA code
  5051.             ....    {main code}
  5052.       while the end mode has the form
  5053.             ....    {main code}
  5054.             GO halt
  5055.             LA sub1
  5056.             .....   {subrountine 1 code}
  5057.             RET
  5058.             LA sub 2
  5059.             ....    {subrountine 2 code}
  5060.             RET
  5061.             ....    {other subrountine  code}
  5062.             RET
  5063.       As an alternative, you could make libraries of subroutines in files
  5064.       called whatever.sub and have whatever.sub have the form
  5065.             GO endwhatever
  5066.             LA sub1
  5067.             .....   {subrountine 1 code}
  5068.             RET
  5069.             LA sub 2
  5070.             ....    {subrountine 2 code}
  5071.             RET
  5072.             ....    {other subrountine  code}
  5073.             LA endwhatever
  5074.       with the main file start with
  5075.             INclude whatever.sub
  5076.  
  5077.  
  5078.       VI.8  IF...THEN...ELSE and CASE
  5079.  
  5080.             Commands: IF, CASE
  5081.             Keywords: THEN, ELSE, BEGIN, END, ENDCASE, OF
  5082.  
  5083.             There are two forms for the IF command without ELSE clause
  5084.               IF compare THEN thencmd
  5085.       or
  5086.  
  5087.  
  5088.       Chapter VI:BUSIC                                           Page 94
  5089.  
  5090.  
  5091.  
  5092.  
  5093.                         Documentation for BATUTIL, Version 4.0
  5094.  
  5095.  
  5096.               IF compare THEN BEGIN
  5097.                 thencmd1
  5098.                 thencmd2
  5099.                 ....
  5100.               END
  5101.       and there are four forms with the ELSE command
  5102.               IF compare THEN thencmd ELSE elsecmd
  5103.       or
  5104.               IF compare THEN BEGIN
  5105.                 thencmd1
  5106.                 thencmd2
  5107.                 ....
  5108.               END ELSE elsecmd
  5109.       or
  5110.               IF compare THEN thencmd ELSE BEGIN
  5111.                 elsecmd1
  5112.                 elsecmd2
  5113.                 ....
  5114.               END
  5115.       or
  5116.               IF compare THEN BEGIN
  5117.                 thencmd1
  5118.                 thencmd2
  5119.                 ....
  5120.               END ELSE BEGIN
  5121.                 elsecmd1
  5122.                 elsecmd2
  5123.                 ....
  5124.               END
  5125.  
  5126.             Put briefly, the else clause is optional and the basic
  5127.                 IF compare THEN thencmd ELSE elsecmd
  5128.       can have either thencmd and/or elsecmd replaced by a set of commands
  5129.       flanked by a BEGIN/END pair.
  5130.  
  5131.             As usual, the commands and keywords need not be capitalized.
  5132.       However, they may not be truncated.  Moreover, the syntax of separate
  5133.       lines (or separations with {}[]) must be observed.
  5134.  
  5135.             As you'd expect, if the comparison in "compare" is true, then
  5136.       thencmd(s) are issued.  If it is false, the elsecmd(s) are.
  5137.  
  5138.             Nested IF...THEN's are allowed but be careful of the following
  5139.       ambiguous situation:
  5140.  
  5141.  
  5142.       Chapter VI:BUSIC                                           Page 95
  5143.  
  5144.  
  5145.  
  5146.  
  5147.                         Documentation for BATUTIL, Version 4.0
  5148.  
  5149.  
  5150.             IF compare1 THEN IF compare2 THEN cmd1 ELSE cmd2
  5151.       Resolve the ambiguity by using either
  5152.             IF compare1 THEN BEGIN
  5153.               IF compare2 THEN cmd1 ELSE cmd2
  5154.             END
  5155.       or
  5156.             IF compare1 THEN BEGIN
  5157.               IF compare2 THEN cmd1
  5158.             END ELSE cmd2
  5159.  
  5160.             CASE commands have the syntax
  5161.               CASE string OF
  5162.                 choice1: cmd11
  5163.                          cmd12
  5164.                 choice2: cmd22
  5165.                     .....
  5166.               ENDCASE
  5167.       The keyword ENDCASE is required.  If it ever occurs except as a
  5168.       match to a CASE, there will be an exit with error.  The OF is
  5169.       optional.
  5170.  
  5171.             The string has metastring translation done but the choices
  5172.       do not.  There is an implied BEGIN/END after each : - do not use an
  5173.       explicit one.  If you ever need a command with a : in it, and it is
  5174.       not on the same line as the choice:, then enclose it in double
  5175.       quotes.
  5176.  
  5177.             Explicitly nested CASE statements are NOT allowed but you can
  5178.       CALL a subroutine with a CASE statement from within another CASE
  5179.       statement and so get the same effect.
  5180.  
  5181.  
  5182.       VI.9  FOR, REPEAT and WHILE
  5183.  
  5184.             Commands: FOR, REPEAT, WHILE
  5185.             Keywords: =, UNTIL, TO, DO
  5186.  
  5187.             In this section, we discuss three loop commands which allow
  5188.       repetition with one of more variables changed.  Note that the FOR
  5189.       loop has an explicit variable changed while you'll need to change
  5190.       something in a WHILE or REPEAT loop to avoid looping indefinitely
  5191.       (remember ^-Break to get out if need be).
  5192.  
  5193.  
  5194.  
  5195.  
  5196.       Chapter VI:BUSIC                                           Page 96
  5197.  
  5198.  
  5199.  
  5200.  
  5201.                         Documentation for BATUTIL, Version 4.0
  5202.  
  5203.  
  5204.             The FOR command has two forms - a list, as discussed in the
  5205.       next section and a numeric form.  The numeric form has two versions:
  5206.             FOR $*= start TO stop DO cmd
  5207.       or
  5208.             FOR $*= start TO stop DO BEGIN
  5209.               cmd1
  5210.               cmd2
  5211.               ....
  5212.             END
  5213.  
  5214.             $* must be one of the thirty variables $1,...,$0,$é,...,$ò. TO
  5215.       is a required keyword and DO is optional.  "start" and "stop" must
  5216.       both be integers in the range -32767,...,32767.  $* is
  5217.       increased/decreased one at a time depending on whether stop is
  5218.       larger/smaller than start.  If start=stop, then the command is done
  5219.       once.  Metastring translation is done to both start and stop.
  5220.  
  5221.             Nested FOR loops are allowed but be careful to use different
  5222.       variables.  In general, be careful to avoid accidentally changing a
  5223.       for variable in the commands issued during the FOR loop.
  5224.  
  5225.             WHILE loops have the form either
  5226.               WHILE compare DO cmd
  5227.       or
  5228.               WHILE compare DO BEGIN
  5229.                 cmd1
  5230.                 cmd2
  5231.                 ...
  5232.               END
  5233.  
  5234.             The DO is NOT optional in this case.  If compare starts out
  5235.       false, then the loop is not done at all.  At the end of each loop,
  5236.       compare is reevaluated and the WHILE terminated if it is false.  Be
  5237.       careful to be sure that the loop will produce the changes need to
  5238.       terminate the loop.
  5239.  
  5240.             REPEAT loops have the form
  5241.               REPEAT
  5242.                 cmd1
  5243.                 cmd2
  5244.                 ....
  5245.               UNTIL compare
  5246.  
  5247.  
  5248.  
  5249.  
  5250.       Chapter VI:BUSIC                                           Page 97
  5251.  
  5252.  
  5253.  
  5254.  
  5255.                         Documentation for BATUTIL, Version 4.0
  5256.  
  5257.  
  5258.             REPEAT loops differ from WHILE loops in two ways:
  5259.               - the compare is checked at the end so the loop is always
  5260.                   gone through at least once
  5261.               - WHILE loops iterate when compare is true; REPEAT loops
  5262.                   iterate when compare is false
  5263.  
  5264.  
  5265.       VI.10 FOR Loops with Lists, Files and Directories
  5266.  
  5267.             Commands: FOR and FORDIR
  5268.             Keywords: IN
  5269.  
  5270.             BATUTIL has loops which will repeat a process with replacement
  5271.       of a variable from an explicit list or one generated by the system.
  5272.       Two of the possibilities are essentially like DOS batch file's
  5273.       for..in...do loops and there is a third for directories.
  5274.  
  5275.             The syntax for the first two is either
  5276.               FOR $* IN (list) DO cmd
  5277.       or
  5278.               FOR $* IN (list) DO BEGIN
  5279.                 cmd1
  5280.                 cmd2
  5281.                 ....
  5282.               END
  5283.  
  5284.             As with numeric FOR loops, $* must be one of the thirty
  5285.       variables $1,...,$0,$é,...,$ò and DO is optional while IN is
  5286.       required.  The component "list" is a set of words separated by
  5287.       spaces.  Metastring translation is not done on the string but is done
  5288.       on each word in the list so that
  5289.             FOR $1 IN (abc$Sdef ghi) DO ECHOLN $1
  5290.       would output
  5291.             abc def
  5292.             ghi
  5293.  
  5294.             The loop variable which we'll denote $* is set successively to
  5295.       the words on the list so long as those words do not contain the
  5296.       wildcards * or ?.  If these wildcards occur in some words, then for
  5297.       those words BATUTIL looks for matching filenames and files those in.
  5298.       There is a limit of roughly 500 total matches on the list.
  5299.  
  5300.       Using FORDIR is similar to using a for loop with filename wildcards
  5301.       but instead it traverses whole directory trees or whole branches.
  5302.  
  5303.  
  5304.       Chapter VI:BUSIC                                           Page 98
  5305.  
  5306.  
  5307.  
  5308.  
  5309.                         Documentation for BATUTIL, Version 4.0
  5310.  
  5311.  
  5312.       The syntax is
  5313.               FORDIR $* IN (dirlist) DO cmd
  5314.       or
  5315.               FORDIR $* IN (dirlist) DO BEGIN
  5316.                 cmd1
  5317.                 cmd2
  5318.                 ....
  5319.               END
  5320.  
  5321.       Dirlist consist of one or more words, each of which is a directory
  5322.       name.  $* will then be set successively to each subdirectory of the
  5323.       directories in the list.  If dirlist is empty, then a \ is used (i.e.
  5324.       the root is taken so the list of values will be all directories in
  5325.       the list).
  5326.  
  5327.             In each listing, BATUTIL first goes through all directories at
  5328.       a given level, that is for (\), first $* is set to \, then
  5329.       successively all direct subdirectories, than all subsubdirectories,
  5330.       etc.
  5331.  
  5332.             FORDIR is useful for going successively through each directory
  5333.       and issuing commands.  With the string manipulation, you could
  5334.       specify a subset of directories with a condition based on the name.
  5335.  
  5336.             In the native output of a FORDIR list, the root directory ends
  5337.       in \ and others do not so if you try something like $1\*.*, it won't
  5338.       be right in the root while, $1*.* won't be right in other
  5339.       directories.  The solution is to use $A since
  5340.             $2=$A($1\)
  5341.       would always yield a single trailing backslash.
  5342.  
  5343.  
  5344.       V.11 Internal Structure
  5345.  
  5346.             Most users will be able to skip this section but if you get
  5347.       heavily into BUSIC programming and in particular if you want to use
  5348.       any debugging beyond the simple interactive trace mode, you'll need
  5349.       to know a little about the internal structure of how BATUTIL
  5350.       processes commands.
  5351.  
  5352.             BATUTIL organizes commands into 'levels'.  Basically, whenever
  5353.       it needs to process some kind of loop or other nestable structure, it
  5354.       makes a new level and closes that level when the loop, CALL or
  5355.       BEGIN/END sequence is done.  A pointer to next command at a given
  5356.  
  5357.  
  5358.       Chapter VI:BUSIC                                           Page 99
  5359.  
  5360.  
  5361.  
  5362.  
  5363.                         Documentation for BATUTIL, Version 4.0
  5364.  
  5365.  
  5366.       level is kept so BATUTIL knows where to continue when a loop or CALL
  5367.       is done.
  5368.  
  5369.             Each level can accommodate 1024 commands at most and has a
  5370.       minimal overhead of about 4K of RAM plus the total lengths of all the
  5371.       commands actually present at that level.
  5372.  
  5373.             BATUTIL begins by reading in all commands in the BU@
  5374.       environmental variable and parses that into separate commands which
  5375.       it places into command level zero.  It then looks at its command
  5376.       line, parses it and places those commands after the BU@ commands.
  5377.       Whenever it places a command into a level, it checks the first
  5378.       command word to confirm that it is a legitimate BATUTIL command.  It
  5379.       will truncate commands with a minimal truncation to two letters but
  5380.       otherwise does no syntax checking or command translation at that
  5381.       time.
  5382.  
  5383.             It then begins analyzing and carrying out the commands at
  5384.       cmdlevel 1.  If it comes across an INclude (equivalently FCommand)
  5385.       command, it reads in the commands from the file inserting them into
  5386.       the set of commands it keeps in memory.  A new level is not made for
  5387.       such an INclude.
  5388.  
  5389.             The two primitive BUSIC commands are GOto and the non-compound
  5390.       IF..THEN..ELSE.  GOto is processed by looking for LAbels - first from
  5391.       the start of the current command level and then successively down one
  5392.       level at a time.  When the label is found, all higher levels are
  5393.       disposed of and processing is begun at that label.
  5394.  
  5395.             A CALL is processed by copying all the commands from the label
  5396.       to the next RET into a new cmdlevel and starting that command level.
  5397.  
  5398.             The simplest situation requiring a new level is a BEGIN/END
  5399.       pair.  When an IF..THEN..ELSE condition determines that a set of
  5400.       commands in between a BEGIN/END needs to be processed, BATUTIL,
  5401.       copies those commands to a new level and starts with the first.
  5402.  
  5403.             Most other BUSIC commands are translated internally into the
  5404.       two basic primitives.  Explicitly:
  5405.             FOR $1=1 TO 17 DO BEGIN
  5406.               cmd1
  5407.               cmd2
  5408.             END
  5409.       has BATUTIL SEt $1 to the value 1 and produces a new cmdlevel with
  5410.  
  5411.  
  5412.       Chapter VI:BUSIC                                          Page 100
  5413.  
  5414.  
  5415.  
  5416.  
  5417.                         Documentation for BATUTIL, Version 4.0
  5418.  
  5419.  
  5420.       commands of the form:
  5421.             LA BATUTILxxx               (where xxx is a number)
  5422.             cmd1
  5423.             cmd2
  5424.             ++$1
  5425.             IF ~$1=17 GOto BATUTILxxx
  5426.  
  5427.             WHILEs and REPEATs are translated into similar by hand loops.
  5428.       FOR lists and FORDIR have BATUTIL first evaluate the list if it has
  5429.       files (or directories).  Then if the DO is a single command, a crude
  5430.       set/cmd succession is done.  If a set of commands, then a CALL is
  5431.       used instead.  Thus
  5432.             FOR $1 in (abc def ghi) do cmd1
  5433.       would produce a cmdlevel
  5434.             SEt $1=abc
  5435.             cmd1
  5436.             SEt $1=def
  5437.             cmd1
  5438.             SEt $1=ghi
  5439.             cmd1
  5440.       while
  5441.             FOR $1 in (abc def ghi) do begin {} cmd1 {} cmd2 {} end
  5442.       would produce a cmdlevel
  5443.             LA BATUTILxxx
  5444.             cmd1
  5445.             cmd2
  5446.             RET
  5447.             SEt $1=abc
  5448.             CALL BATUTILxxx
  5449.             SEt $1=def
  5450.             CALL BATUTILxxx
  5451.             SEt $1=ghi
  5452.             CALL BATUTILxxx
  5453.       where the pointer to the starting command is placed right after the
  5454.       ret when the level begins.
  5455.  
  5456.             CASE statements make use of gotos with a variable label.  So,
  5457.       for example
  5458.             CASE $1 OF
  5459.               abc: cmd11
  5460.                    cmd12
  5461.               def: cmd21
  5462.                    cmd22
  5463.             ENDCASE
  5464.  
  5465.  
  5466.       Chapter VI:BUSIC                                          Page 101
  5467.  
  5468.  
  5469.  
  5470.  
  5471.                         Documentation for BATUTIL, Version 4.0
  5472.  
  5473.  
  5474.       would produce a new cmdlevel of the form:
  5475.             CALL BATUTILxxxN$1
  5476.                            ~
  5477.             GO exit
  5478.             LA BATUTILxxxNabc
  5479.                          ~
  5480.             cmd11
  5481.             cmd12
  5482.             RET
  5483.             LA BATUTILxxxNdef
  5484.                          ~
  5485.             cmd21
  5486.             cmd22
  5487.             RET
  5488.  
  5489.  
  5490.       VI.12 Trace Mode
  5491.  
  5492.             Command: TRace
  5493.             Parameters: Ffilename, Wvarname, W-, ON, OFF, *, %,
  5494.                           nnn, $nn, Xnn, X$nn
  5495.  
  5496.             BATUTIL comes with a debug mode.  The simplest version of it
  5497.       and the one most users will restrict themselves to is interactive
  5498.       trace mode.  This is turned on with the command
  5499.             {TRace on}
  5500.       or if you hit ^-Break, and answer NO to the first question about
  5501.       halting BATUTIL, you get a chance to turn trace on.  Trace will be
  5502.       turned on AFTER the current command is executed.
  5503.  
  5504.             Once on, you can turn trace off with an explicit
  5505.               {TRace off}
  5506.       in the code stream or with one of the interactive commands.
  5507.  
  5508.             When in trace mode, a little menu appears at the top of the
  5509.       screen:
  5510.  
  5511.       BATUTIL's Interactive Trace Facility
  5512.         Next command is EC hi
  5513.         (C)ontinue, (H)alt, (E)nvironmental variables, (I)nternal variables
  5514.                     (L)ook at screen, (T)race off, (P)ause off
  5515.  
  5516.       Here is what each choice means:
  5517.         C (or <Enter> or <Esc>) : execute next command
  5518.         H                       : end this running of BATUTIL
  5519.         E                       : call up the interactive environment
  5520.                                     viewer/editor (same as batutil {ED})
  5521.  
  5522.  
  5523.       Chapter VI:BUSIC                                          Page 102
  5524.  
  5525.  
  5526.  
  5527.  
  5528.                         Documentation for BATUTIL, Version 4.0
  5529.  
  5530.  
  5531.         I                       : call up the interactive internal variable
  5532.                                     viewer/editor (same as batutil {ED $})
  5533.         L                       : display 5 lines at the top covered by
  5534.                                     the menu; return to menu with any key
  5535.         T                       : turn off master debug switch (same as
  5536.                                 {TRace off})
  5537.         P                       : turns off pause after each command but
  5538.                                     will continue writing to file or
  5539.                                     screen (same as {TRace X32}; see below)
  5540.       After, E, I or L, the menu will reappear before the next command is
  5541.       issued.  Any editing you do of the environment or internal variables
  5542.       which you save will be in effect for subsequent commands.
  5543.  
  5544.             In addition to this interactive mode, BATUTIL can send
  5545.       information to a file (or screen) - often a very large amount of
  5546.       information.  For example with % debug info turned on (see below),
  5547.       the simple set of BATUTIL commands
  5548.             FOR $1=1 TO 10 BEGIN
  5549.               CO 15
  5550.               FOR $2=1 TO 10 ECho $s(F,$V($1*$2),R,4)
  5551.               ECHOLN
  5552.             END
  5553.       produces a debug file which is almost half a megabyte!
  5554.  
  5555.             BATUTIL keeps the track of what kind of debug information you
  5556.       want with a byte - a number from 0 to 255 which is a sum of some
  5557.       subset of the following values:
  5558.               1 = master switch
  5559.               2 = whether debug info is sent to screen
  5560.               4 = whether all non blank internal variables are reported
  5561.               8 = whether to report on variables explicitly watched
  5562.              16 = whether to report on environmental variables
  5563.              32 = whether to interactively debug
  5564.              64 = whether to show the current level of commands
  5565.             128 = whether to show all commands
  5566.       Obvious overrides hold - for example, if 128 is on, then 64 is
  5567.       ignored.
  5568.  
  5569.             The master switch by itself does nothing but it must be on to
  5570.       have any debug actions taken but without any other switches on all
  5571.       is save to the debug file is the next command.  The purpose of the
  5572.       master switch is to have {TR X1} toggle on/off debug keeping all the
  5573.       other debug options in place.
  5574.  
  5575.  
  5576.  
  5577.       Chapter VI:BUSIC                                          Page 103
  5578.  
  5579.  
  5580.  
  5581.  
  5582.                         Documentation for BATUTIL, Version 4.0
  5583.  
  5584.  
  5585.             Modes are controlled with parameters to the TRace command.
  5586.       Here are the allowed parameters:
  5587.  
  5588.             F      followed by a filename with or without path; no spaces
  5589.                      after f
  5590.             W      followed by an environmental variable turns on watch for
  5591.                      that variable
  5592.             W-     followed by an environmental variable drops watch for
  5593.                      that variable
  5594.             nnn    for a number is the same as turning on the flags above
  5595.                      for example if nnn=161, the 1, 32 and 128 switches
  5596.                      would be turned on
  5597.             $nn    like nnn but nn is now a Hexadecimal number
  5598.             Xnnn   xors the flags with nnn
  5599.             X$nn   xors the flags with nn hex
  5600.             OFF    turns off the master switch; leaves the other flags alone
  5601.             ON     is the same as 33 (turns on master switch and
  5602.                      interactive mode)
  5603.             %      same as 133 - master, plus all commands plus internal
  5604.                      variables - best for reporting to a file
  5605.             *      same as 181 - master switch, all commands, all
  5606.                      environmental and internal variables plus interactive
  5607.  
  5608.             Here are a few details of some of the parameters.  The filename
  5609.       that appears after F with no spaces (e.g. {TR FC:\trace.txt %}) will
  5610.       be erased if it already exists without warning - the assumption is
  5611.       that you'll reuse the same file over and over.  If there is a problem
  5612.       with the file (invalid path at startup, disk full....), BATUTIL will
  5613.       report to you:
  5614.  
  5615.       Fatal error with debug file <filename>
  5616.         Error involves <error type>
  5617.         No longer writing to file; writing to console instead.
  5618.         Hit a key to continue. (<Esc> aborts.)
  5619.  
  5620.       Esc will abort; any other key will continue with debug information
  5621.       written to the screen.
  5622.  
  5623.             BATUTIL keeps a list of up to 64 variables which it will
  5624.       explicitly track in reports.  You add/delete from this list with the
  5625.       W and W- commands.  Either environmental or internal variables can be
  5626.       watched.  You have watched variables added to the debug file by
  5627.       turning on the switch with value 8.  If you prefer you can have all
  5628.       environmental and/or all internal variables reported with the 4 and
  5629.  
  5630.  
  5631.       Chapter VI:BUSIC                                          Page 104
  5632.  
  5633.  
  5634.  
  5635.  
  5636.                         Documentation for BATUTIL, Version 4.0
  5637.  
  5638.  
  5639.       16 switches.
  5640.  
  5641.  
  5642.       VI.13 Hacker Mode
  5643.  
  5644.             Command: HACKER +
  5645.             Metastrings: $Z(XXXX:YYYY), $z(YYYY)
  5646.  
  5647.             BATUTIL has the equivalent of BASIC's PEEKs, POKEs, INs and
  5648.       OUTs.  Since the commands that write to memory and ports can cause
  5649.       havoc in careless hands, BATUTIL is set up to not allow these
  5650.       commands.  You must explicitly turn on "hacker mode" to enable the
  5651.       metastrings below - if you do not, you'll get metastring translation
  5652.       errors if you try to use these strings.
  5653.  
  5654.             You turn on hacker mode with
  5655.               {HACKER +}
  5656.       the word must be spelled out in full.
  5657.  
  5658.             Once hacker mode is one you can:
  5659.  
  5660.       Read from memory: anywhere that metastring translation is on
  5661.       $Z(XXXX:YYYY) will read the byte in memory at address XXXX:YYYY (hex)
  5662.       and replace that string with the corresponding Hex value.  For
  5663.       example
  5664.             IF $Z(0:417)=40 THEN ECho Capslock is on
  5665.  
  5666.       Write to memory: If Hacker mode is on
  5667.             SEt $Z(XXXX:YYYY)=GG
  5668.       will write the hex value GG to address XXXX:YYYY.  For example
  5669.             SEt $Z(0:417)=40
  5670.       will turn on capslock.
  5671.  
  5672.       Read from a port: anywhere that metastring translation is on $z(XXXX)
  5673.       will read from that port and replace that string with the
  5674.       corresponding Hex value.  XXXX is in Hex.
  5675.  
  5676.       Write to a port: If Hacker mode is on
  5677.             SEt $z(XXXX)=GG
  5678.       will write the hex value GG to port XXXX.
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.       Chapter VI:BUSIC                                          Page 105
  5686.  
  5687.  
  5688.  
  5689.  
  5690.                           Chapter VII:TIPS AND EXAMPLES
  5691.  
  5692.       VII.1 General tips
  5693.  
  5694.             After a BATUTIL menu, you'll typically need to branch on a
  5695.       number of different possibilities.  The commands
  5696.             IF $r=6 GOto menu6
  5697.             IF $r=5 GOto menu5
  5698.             IF $r=4 GOto menu4
  5699.             IF $r=3 GOto menu3
  5700.             IF $r=2 GOto menu2
  5701.             IF $r=1 GOto menu1
  5702.       followed by choice 0 code will work but the following is more
  5703.       elegant.  If there are six menu choices, have labels menu0,...,
  5704.       menu6.  Use
  5705.             GOto menu$r
  5706.       For an example of this see the sample batch file BUDEMO.BAT.
  5707.  
  5708.             It is most convenient to place the fmenu and fecho lines in
  5709.       the batch file itself.  If the batch file is foobar.bat, you could
  5710.       use
  5711.             {FEcho foobar.bat label}
  5712.       but that will fail if the user renames the batch file so use
  5713.             {FEcho %0 label}
  5714.       instead.  To handle this possibility, BATUTIL looks first for the
  5715.       filename specified with a {fecho ....} command by name and if that
  5716.       fails it tries the extension bat.
  5717.  
  5718.  
  5719.       VII.2 Returning to your Initial Directory
  5720.  
  5721.             You can arrange to return to your initial directory in a
  5722.       batch file, say one that changes to C:\123 and runs lotus with
  5723.             batutil {SEt dr=$n di=$p}
  5724.             C:
  5725.             cd \123
  5726.             lotus
  5727.             %dr%:
  5728.             cd %di%
  5729.       This uses DOS' environmental substitution.
  5730.  
  5731.             You could arrange to save a set of your earlier directories and
  5732.       return to them with two batch files, pushdir and popdir.
  5733.       Pushdir.bat would read
  5734.             batutil {SEt dr3=$x(dr2) di3=$x(di2) dr2=$x(dr1) di2=$x(di1)
  5735.                           dr1=$n di1=$p}
  5736.       all on one line.  Popdir would read
  5737.  
  5738.  
  5739.       Chapter VII:TIPS AND EXAMPLES                             Page 106
  5740.  
  5741.  
  5742.  
  5743.  
  5744.                         Documentation for BATUTIL, Version 4.0
  5745.  
  5746.  
  5747.             %dr1%
  5748.             cd %dr1%
  5749.             batutil {SEt dr2=$x(dr3) di2=$x(di3) dr1=$x(dr2) di1=$x(di2)
  5750.                            dr3=  di3= }
  5751.  
  5752.             In terms of directory manipulation, suppose you not only want
  5753.       to return to the original directory but you have a program silly in
  5754.       \foo which insists that its directory be in the path even if it is
  5755.       the default directory.  You want to add it to the path but later
  5756.       remove it.  Use:
  5757.             batutil {SEt dr=$n di=$p}{ad C:\foo}
  5758.             C:
  5759.             cd \foo
  5760.             silly
  5761.             batutil {DE C:\foo)
  5762.             %dr%:
  5763.             cd %di%
  5764.  
  5765.       VII.3 Using BATUTIL in your autoexec.bat
  5766.  
  5767.             There are a number of actions special to an autoexec.bat
  5768.       that make BATUTIL valuable.  Your autoexec.bat may take a long time
  5769.       to run because you run a defragmenting utility or use a FAT/root dir
  5770.       saver like DOS' mirror or you might copy a lot of files to a RAM
  5771.       disk.  You might care to branch at the end of the batch file, say to
  5772.       run Software Carousel or not.  Of course, you can ask a question but
  5773.       what if you don't want to always stand around and would like to
  5774.       default to running Carousel if you aren't there?  You could use (as a
  5775.       fragment of your autoexec.bat):
  5776.             batutil {EC Run Carousel (Y/N)?}{GE wa6 y n}
  5777.             if errorlevel 2 goto nocar
  5778.             carousel
  5779.             :nocar
  5780.       You could even have the time counted down by replacing the first
  5781.       line with
  5782.             batutil {EC Run Carousel (Y/N)? $L   secs left}{GE wa6 y n}
  5783.  
  5784.             So you've solved the problem of waiting around if you do want
  5785.       to run Carousel.  But what if you don't want to?  With the above
  5786.       fragment you'd need to wait around.  Here is where the test of the
  5787.       lock keys comes in.  Immediately before the first line of the above
  5788.       fragment, you could put
  5789.             batutil {QL C-}
  5790.             if errorlevel 1 goto nocar
  5791.  
  5792.  
  5793.       Chapter VII:TIPS AND EXAMPLES                             Page 107
  5794.  
  5795.  
  5796.  
  5797.  
  5798.                         Documentation for BATUTIL, Version 4.0
  5799.  
  5800.  
  5801.       Then, if you hit Capslock before you go off Carousel wouldn't run.
  5802.       Actually, you could avoid an extra running of BATUTIL and two
  5803.       lines of the file by using:
  5804.             batutil {QL C-}{IF $r=1 THEN GOto halt2}
  5805.                 {EC Run Carousel (Y/N)?}{GE wa6 y n}
  5806.       as the first line of the fragment.  For then if Caps was set, the
  5807.       GOto halt2 command causes BATUTIL to exit with an errorlevel of 2
  5808.       just as if you answered no!
  5809.  
  5810.             Another problem that you'll often want to cope with in a
  5811.       batch file is some operation, like defragmentation that you only
  5812.       want to run once a day.  Here is a fragment to do that:
  5813.             batutil {TO newday.tst}
  5814.             if not errorlevel 1 goto already
  5815.             echo a >newday.tst
  5816.             STUFF TO DO ONCE
  5817.             :already
  5818.       What this does, is if the error level is exactly 0, then one skips
  5819.       to the label already.  Otherwise, the file newday.tst is given
  5820.       today's date so that the next time it is run, "batutil {to
  5821.       newday.tst}" will return errorlevel 0.  But what if you sometimes
  5822.       work past midnight and don't want the newday stuff done until
  5823.       morning?  Replace
  5824.             batutil {TO newday.tst}
  5825.       with
  5826.             batutil {TO 5 newday.tst}
  5827.       which will make the change over at 5AM rather than midnight.
  5828.  
  5829.  
  5830.       VII.4 A Clean Sweep
  5831.  
  5832.             Here is a simple BATUTIL code fragment that will delete all
  5833.       *.bak files anywhere on disk.
  5834.             SEt buswap=!
  5835.             FORDIR $1 IN () DO BEGIN
  5836.               $2=$A($1\)
  5837.               NU $!($2*.bak)
  5838.               IF $r > 0 THEN BEGIN
  5839.                 RUn command /cdel $2*.bak
  5840.                 ECho $1:$r files erased
  5841.               END
  5842.             END
  5843.  
  5844.  
  5845.  
  5846.  
  5847.       Chapter VII:TIPS AND EXAMPLES                             Page 108
  5848.  
  5849.  
  5850.  
  5851.  
  5852.                         Documentation for BATUTIL, Version 4.0
  5853.  
  5854.  
  5855.             Note the use of $2=$A($1\) to place a single trailing backslash
  5856.       as explained in Section VI.10.   Note the supermetastring $! in the
  5857.       nu command, necessary because metastring translation is not done on
  5858.       that command.
  5859.  
  5860.  
  5861.       VII.5 Directory Lister with Smart Wildcards
  5862.  
  5863.             PC Magazine's user to user column has had a number of letters
  5864.       about how to get a name listing of all files whose names includes a
  5865.       string anywhere in the filename, see, for example v10, n16, pg 424.
  5866.       Here's a way to do it with BUSIC:
  5867.             @echo off
  5868.             if '%1'=='' goto error
  5869.             batutil {$1=%1}{IN %0 code}
  5870.             for %%a in (%foo##%) do echo %%a
  5871.             set foo##=
  5872.             goto end
  5873.             :code
  5874.             $2=$s(S,$1) $5=$1*.* $4=?
  5875.             FOR $3=8 TO 2 DO BEGIN
  5876.               IF $2=$3 THEN GO next
  5877.               $5=$5$S$4$1*.*
  5878.               $4=?$4
  5879.             END
  5880.             LA next
  5881.             CASE $2 OF
  5882.               1: $5=$5$S*.$1*$S*.?$1*$S*.??$1
  5883.               2: $5=$5$S*.$1*$S*.?$1
  5884.               3: $5=$5$S*.$1
  5885.             ENDCASE
  5886.             SET foo##=$5
  5887.             :error
  5888.             echo a parameter is required
  5889.             :end
  5890.  
  5891.  
  5892.       VII.6 A Two Year Olds' Delight
  5893.  
  5894.             Here is a simple batch file which delighted Barry's two year
  5895.       old daughter
  5896.             for %%a in (1 2 3 4 5 6 7 8 9) do batutil {GE IN}{SO 1%%a}
  5897.       This will wait for the insert key and then play 9 tunes.  The
  5898.       INsert key was especially picked for two reasons: it is large and
  5899.  
  5900.  
  5901.       Chapter VII:TIPS AND EXAMPLES                             Page 109
  5902.  
  5903.  
  5904.  
  5905.  
  5906.                         Documentation for BATUTIL, Version 4.0
  5907.  
  5908.  
  5909.       easy for little hands to reach.  It is not a repeating key so that
  5910.       it is less likely that several keystrokes will get through and
  5911.       abort the tunes.
  5912.  
  5913.  
  5914.       VII.7 Sample Batch Files
  5915.  
  5916.             You will learn a lot about how to use BATUTIL by studying the
  5917.       sample batch files provided.  We'll make some comments about them
  5918.       here.
  5919.  
  5920.             The complicated contortions in the BATUTIL 1.0 manual are no
  5921.       longer needed because we can use internal variables on the whole.
  5922.       Notice that we use {RC $} command to prevent RC from being placed in
  5923.       the environment.
  5924.  
  5925.             Budemo {FEcho %0} and a variant on the goto fmenu$r tricks
  5926.       discussed in Section 1 (we use CALL in place of GOto).  It turns the
  5927.       cursor off with the
  5928.             set cur=off
  5929.       command.
  5930.  
  5931.             Most of the separate batch demos are called with a simple use
  5932.       of FCommand.  Notice that this use allows the same code to be used to
  5933.       call the subsidiary batch files from within BUDEMO.BAT as well as
  5934.       stand alone.
  5935.  
  5936.             Notice how BUDEMO sees if batutil.hlp is in the current
  5937.       directory or on the path and stores the information in $Å.  It then
  5938.       calls the appropriate menu with a
  5939.             FM $!(%0 fmain$Å)
  5940.       The supermetastring $!(...) is needed because FM does not normally do
  5941.       metastring translation.
  5942.  
  5943.             Because calling help requires a separate running of BATUTIL, we
  5944.       need some fancy footwork with DOS batch files to call help from the
  5945.       ninth menu choice.
  5946.  
  5947.             Soundemo.bat is also straightforward.  Note the way the
  5948.       fpretty command is used to produce the second screen with its
  5949.       special box.
  5950.  
  5951.             Showdemo's most interesting feature may be the last panel
  5952.       that illustrates how to use the fpretty command for a display of
  5953.  
  5954.  
  5955.       Chapter VII:TIPS AND EXAMPLES                             Page 110
  5956.  
  5957.  
  5958.  
  5959.  
  5960.                         Documentation for BATUTIL, Version 4.0
  5961.  
  5962.  
  5963.       different columns in different colors.  Note the use of the $$.
  5964.  
  5965.             Note inputdem's use of $L with spaces after it.
  5966.  
  5967.             Note that equip gets all its information and saves it in
  5968.       internal variables and then displays it all at once.
  5969.  
  5970.             The study of these samples should give you an idea of how to
  5971.       use BATUTIL.
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.       Chapter VII:TIPS AND EXAMPLES                             Page 111
  6010.  
  6011.  
  6012.  
  6013.  
  6014.                    Chapter VIII:COMMAND REFERENCE
  6015.  
  6016.       In this chapter, we present an alphabetical list of commands with a
  6017.       complete reference for each command in the following format:
  6018.  
  6019.       COMMAND         []/{}       Input: INPUT        Output: OUTPUT
  6020.             Parameters: LIST
  6021.             DESCRIPTION
  6022.             Values: LIST
  6023.             Manual reference: LIST
  6024.             Examples: SAMPLES
  6025.             Internal parameters: LIST
  6026.             See also: LIST
  6027.       ----------------------------------------------------------------------
  6028.       Hereafter each command appears []/{} or just {} to indicate whether
  6029.       the command can appear on the command line only within {} or if [] is
  6030.       also allowed.  The items in CAPS change from item to item.
  6031.           Input is one or more of the following (inside [] we indicate
  6032.       the abbreviation used):
  6033.             Cmdline [CM]        indicates the command takes parameters
  6034.             System  [SY]        indicates that it reads the internals of
  6035.                                   your computer
  6036.             Batutil [BU]        uses internal flags in BATUTIL
  6037.             User    [US]        input from user required
  6038.             File    [FI]        text in a file between sets of labels
  6039.           Output is one or more of the following (inside [] we indicate
  6040.       the abbreviation used):
  6041.             Errorlevel [EL]     sets errorlevel and/or the variable RC
  6042.             Environment [EN]    effects one or more environmental variables
  6043.             Display  [DI]       displays on screen or speaker
  6044.             Internal [IN]       if an internal flag like CS is effected
  6045.             External [EX]       some other program or file is effected
  6046.           If a command is a BUSIC Command or Keyword, we say so instead of
  6047.       listing Input and Output Fields
  6048.           Values only appears if the commands returns one of a set of
  6049.       numbers and lists those values.  Internal parameters lists the
  6050.       internal flags (if any) like CS which BATUTIL keeps and which
  6051.       effect the command.  Manual reference gives cross references to the
  6052.       manual.
  6053.  
  6054.       ----------------------------------------------------------------------
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.  
  6063.       Chapter VIII:COMMAND REFERENCE                            Page 112
  6064.  
  6065.  
  6066.  
  6067.  
  6068.                         Documentation for BATUTIL, Version 4.0
  6069.  
  6070.  
  6071.       #Altmon         []/{}       Input: SY           Output: EL
  6072.             Parameters: None
  6073.             Returns the type of a second monitor, if any
  6074.             Values:
  6075.                0 = none                   8 = vga color
  6076.                1 = monochrome  (MDA)     11 = mcga mono
  6077.                2 = cga color             12 = mcga color
  6078.                4 = ega color             21 = hercules mono
  6079.                5 = ega mono              22 = hercules monochrome plus
  6080.                6 = prof. graphics        23 = hercules Incolor
  6081.                7 = vga mono
  6082.             Manual reference: Section II.4
  6083.             Examples: batutil [#A]
  6084.             See also: #Terminal, #Whichmon, @Terminal
  6085.       ----------------------------------------------------------------------
  6086.       #Comm           []/{}       Input: SY           Output: EL
  6087.             Parameters: None
  6088.             Returns the number of comm ports from 0 to 4 as determined from
  6089.       non-zero addresses in the BIOS area.  If there are more than two comm
  6090.       ports, this number may not be accurate since DOS only supports two comm
  6091.       ports and some non-standard method may be used by the system.
  6092.             Values: 0 through 4
  6093.             Manual reference: Section II.5
  6094.             Examples: batutil [#C]
  6095.       ----------------------------------------------------------------------
  6096.       #Disk           []/{}       Input: SY           Output: EL
  6097.             Parameters: Drive letter; no parameter means default drive
  6098.             This command returns the total disk space; for drives A and B in
  6099.       units of 8K; for other drives in units of 256K; rounded down; capped at
  6100.       199.
  6101.             Values: 0 to 199; 239 means invalid drive letter or drive not
  6102.       ready
  6103.             Manual reference: Section II.3
  6104.             Examples: batutil [#D C]
  6105.             See also: @Disk
  6106.       ----------------------------------------------------------------------
  6107.       #Env            []/{}       Input: SY           Output: EL
  6108.             Parameters: None
  6109.             Total environment space in units of 16 bytes up to 3184.
  6110.             Values: 0 to 199 (199 for 3184 bytes of environment or more)
  6111.             Manual reference: Section II.3
  6112.             Examples: batutil [#E]
  6113.             See also: @Env
  6114.       ----------------------------------------------------------------------
  6115.  
  6116.  
  6117.       Chapter VIII:COMMAND REFERENCE                            Page 113
  6118.  
  6119.  
  6120.  
  6121.  
  6122.                         Documentation for BATUTIL, Version 4.0
  6123.  
  6124.  
  6125.       #Floppy         []/{}       Input: SY           Output: EL
  6126.             Parameters: None
  6127.             Number of floppy drives as reported by the BIOS equipment byte
  6128.             Values: 0 to 4
  6129.             Manual reference: Section II.5
  6130.             Examples: batutil [#F]
  6131.             See also: @Floppy
  6132.       ----------------------------------------------------------------------
  6133.       #Game           []/{}       Input: SY           Output: EL
  6134.             Parameters: None
  6135.             Number of game ports as reported by the BIOS equipment byte
  6136.             Values: 0 or 1
  6137.             Manual reference: Section II.5
  6138.             Examples: batutil [#G]
  6139.       ----------------------------------------------------------------------
  6140.       #Intel          []/{}       Input: SY           Output: EL
  6141.             Parameters: None
  6142.             Returns the CPU type
  6143.             Values: 0 = 8086/8088; 1 = 80186; 2 = 80286; 3 = 80386;
  6144.               4 = 80486; 20 = NEC V20/V30
  6145.             Manual reference: Section II.5
  6146.             Examples: batutil [#I]
  6147.             See also: @Intel
  6148.       ----------------------------------------------------------------------
  6149.       #Keyboard       []/{}       Input: SY           Output: EL
  6150.             Parameters: None
  6151.             Tests for the presence of BIOS support for the enhanced (101 key)
  6152.       keyboard
  6153.             Values: 0 = not enhanced; 1 = enhanced
  6154.             Manual reference: Section II.4
  6155.             Examples: batutil [#K]
  6156.       ----------------------------------------------------------------------
  6157.       #Lim            []/{}       Input: SY           Output: EL
  6158.             Parameters: None
  6159.             Reports the total amount of Lotus Intel Microsoft Expanded memory
  6160.       in units of 64K up to 12736 K (rounded down)
  6161.             Values: 0 to 199 (0 if no EMS)
  6162.             Manual reference: Section II.3
  6163.             Examples: batutil [#L]
  6164.             See also: LIm, #Mem, #Xtended, @Lim, @Mem, @Xtended
  6165.       ----------------------------------------------------------------------
  6166.  
  6167.  
  6168.  
  6169.  
  6170.  
  6171.       Chapter VIII:COMMAND REFERENCE                            Page 114
  6172.  
  6173.  
  6174.  
  6175.  
  6176.                         Documentation for BATUTIL, Version 4.0
  6177.  
  6178.  
  6179.       #Mem            []/{}       Input: SY           Output: EL
  6180.             Parameters: None
  6181.             Returns the total DOS memory in units of 4K rounded down (640K
  6182.       corresponds to 160; because PS/2's have only 639K, 159 will be
  6183.       reported)
  6184.             Values: 0 to 160
  6185.             Manual reference: Section II.3
  6186.             Examples: batutil [#M]
  6187.             See also: #Lim, #Xtended, @Lim, @Mem, @Xtended
  6188.       ----------------------------------------------------------------------
  6189.       #Prn            []/{}       Input: SY           Output: EL
  6190.             Parameters: None
  6191.             Returns the number of printer ports (to which printers may or may
  6192.       not be attached)
  6193.             Values: 0 to 3
  6194.             Manual reference: Section II.5
  6195.             Examples: batutil [#P]
  6196.             See also: @Prn
  6197.       ----------------------------------------------------------------------
  6198.       #Rodent         []/{}       Input: SY           Output: EL
  6199.             Parameters: None
  6200.             Returns 0 if no mouse; 1 if a mouse is present
  6201.             Values: 0 or 1
  6202.             Manual reference: Section II.4
  6203.             Examples: batutil [#R]
  6204.       ----------------------------------------------------------------------
  6205.       #Terminal       []/{}       Input: SY           Output: EL
  6206.             Parameters: None, R, S or C
  6207.             Returns 1 or 2 depending on the number of monitors if
  6208.               no parameter; number of Rows, Columns or Special=Rows - 1
  6209.             Values: 1 or 2; R=25,43,50 typically;  C=40 or 80 typically
  6210.             Manual reference: Section II.4
  6211.             Examples: batutil [#T]; batutil {#T R}{EC Screen has $x(rc) rows}
  6212.             See also: @Terminal, #Altmon, #Whichmon
  6213.       ----------------------------------------------------------------------
  6214.       #Vmode          []/{}       Input: SY           Output: EL
  6215.             Parameters: None
  6216.             Returns the currently active mode, e.g. 7 for monochrome text, 2
  6217.       or 3 for text on a graphics monitor, 16 for EGA hires graphics, etc.
  6218.             Values: 1 to 16
  6219.             Manual reference: Section II.4
  6220.             Examples: batutil [#V]
  6221.             See also: #Terminal, #Altmon, #Whichmon, @Terminal
  6222.       ----------------------------------------------------------------------
  6223.  
  6224.  
  6225.       Chapter VIII:COMMAND REFERENCE                            Page 115
  6226.  
  6227.  
  6228.  
  6229.  
  6230.                         Documentation for BATUTIL, Version 4.0
  6231.  
  6232.  
  6233.       #Whichmon       []/{}       Input: SY           Output: EL
  6234.             Parameters: None
  6235.             Returns the type of the currently active monitor
  6236.             Values:                       8 = vga color
  6237.                1 = monochrome  (MDA)     11 = mcga mono
  6238.                2 = cga color             12 = mcga color
  6239.                4 = ega color             21 = hercules mono
  6240.                5 = ega mono              22 = hercules monochrome plus
  6241.                6 = prof. graphics        23 = hercules Incolor
  6242.                7 = vga mono
  6243.             Manual reference: Section II.4
  6244.             Examples: batutil [#W]
  6245.             See also: #Terminal, #Altmon, #Vmode, @Terminal
  6246.       ----------------------------------------------------------------------
  6247.       #Xtended        []/{}       Input: SY           Output: EL
  6248.             Parameters: None
  6249.             Amount of AT extended memory in units of 64K rounded down up to a
  6250.       maximum of 12736K; with more than that 199 is returned.  On an 80386
  6251.       machine with 386 control software, this number may not be reliable.
  6252.             Values: 0 to 199
  6253.             Manual reference: Section II.3
  6254.             Examples: batutil [#X]
  6255.             See also: #Lim, #Mem, @Lim, @Mem, @Xtended
  6256.       ----------------------------------------------------------------------
  6257.       $!(...)                       Input:CM            Output: IN
  6258.             For ANY BATUTIL command, if the command is given in the form
  6259.                 command $!(...)
  6260.       then ... undergoes metastring translation and is passed to the command.
  6261.       This allows you to force metastring translation of parameters for
  6262.       commands that do not normally get such translation.
  6263.             Manual reference: Section I.5
  6264.       ----------------------------------------------------------------------
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.       Chapter VIII:COMMAND REFERENCE                            Page 116
  6280.  
  6281.  
  6282.  
  6283.  
  6284.                         Documentation for BATUTIL, Version 4.0
  6285.  
  6286.  
  6287.       $%                        Input: BU               Output: EN, DI
  6288.             When IOError is turned off, errors during file read/write (via $R
  6289.       and >) do not cause fatal errors but instead set the value of $% which
  6290.       can be accessed in an IF statement, echo or set.  Possible values are
  6291.                       0: no error, additional lines in the file
  6292.                       1: no error but at end of file
  6293.                       2: file not found
  6294.                       9: invalid path
  6295.                     230: drive not ready
  6296.                     231: other file error
  6297.             Manual reference: Section VI.5
  6298.             Examples: IO - [] $R(foobar.txt) [] if $% > 0 then goto fileerror
  6299.             See also: IOerror, $R
  6300.       ----------------------------------------------------------------------
  6301.       $1,...,$0,$é,...,$ò in diverse cmd    Input: BU, US    Output: IN
  6302.             BATUTIL keeps 30 internal user set variables.
  6303.             Manual reference: Sections VI.1, V.4
  6304.             Examples: batutil {fordir $2 in () do ++ $1}{EC $1 directories}
  6305.             See also: $1=, SEt, ECho, ++, --
  6306.       ----------------------------------------------------------------------
  6307.       $1=,...,$0=,$é=,...,$ò=   {}        Input: CM          Output: IN
  6308.             These commands have an implicit SEt in front so that
  6309.                 $1=67
  6310.       is the same as
  6311.                 set $1=67
  6312.             Manual reference: Sections V.4, VI.1
  6313.             Examples: batutil {$1=0}{fordir $2 in () ++ $1}{EC $1}
  6314.             See also: $1, SEt, ++, --
  6315.       ----------------------------------------------------------------------
  6316.       $A,$a,$B,$C in diverse cmd    Input: SY, CM       Output: EN,DI
  6317.             Parameters: Filespec in ()
  6318.             Parses the file spec in (); $a gives path; $A path with trailing
  6319.       backspace; $B the filename and $C the extension.
  6320.             Manual reference: Section III.2
  6321.             Examples: batutil {SE file=$f(*.bat) ext=$C($x(file))}
  6322.             See also: SEt, $F
  6323.       ----------------------------------------------------------------------
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.       Chapter VIII:COMMAND REFERENCE                            Page 117
  6334.  
  6335.  
  6336.  
  6337.  
  6338.                         Documentation for BATUTIL, Version 4.0
  6339.  
  6340.  
  6341.       $F or $f  in SEt command    Input: SY, CM, US   Output: EN
  6342.             Parameters: None or filespec in ()
  6343.             Calls up a file list from which the user can pick a file which
  6344.       then replaces $f in the SEt command
  6345.             Values: 0 = file picked; 1 = unique matching file;
  6346.               2 = Exit with <Esc>;  3 = Invalid path
  6347.               4 = No wildcards - file not found;  9 = Invalid path
  6348.             Manual reference: Section V.6
  6349.             Examples: batutil {EC Pick a batch file}{SE file=$f(*.bat)}
  6350.             Internal parameters: FDIR, NMouse
  6351.             See also: SEt, FDir, $A,a,B,C
  6352.       ----------------------------------------------------------------------
  6353.       $J,$M,$D, $Y, $W, $E in diverse cmds   Input: CM, SY   Output: EN,DI
  6354.             Parameters: (...) where ... is one of MM/DD/YY, days since
  6355.               12/31/79 or a filename
  6356.             Can be used to access a file date or to interchange between two
  6357.       basic formats: MM/DD/YY, days since 12/31/79 which is needed for date
  6358.       arithmetic
  6359.             Manual reference: Section VI.4
  6360.             Examples: batutil {EC 15 days from now is $E($V($J+15))}
  6361.       ----------------------------------------------------------------------
  6362.       $L  in Echo command         Input: CM, SY       Output: IN
  6363.             Parameters: None
  6364.             The place where $L would have appeared is remembered by
  6365.       BATUTIL and a subsequent GEtkey with a WAit will have a ticking
  6366.       clock placed in the place.  You must place explicit spaces in the
  6367.       echoed string
  6368.             Manual reference: Section IV.5
  6369.             Examples: batutil {EC Today is $E and you have $L   seconds
  6370.                          left}{GE WA60}
  6371.             Internal parameters: TimeRow, TimeCol
  6372.             See also: ROw, COl, ATtribute
  6373.       ----------------------------------------------------------------------
  6374.       $N in SEt command           Input: US, BU       Output: EN
  6375.             Parameters: None
  6376.             In the midst of a SEt string, $N pauses to get a numeric
  6377.       input from the user and that string then replaces the $N.  You set
  6378.       colors with the AT/MN commands.  The user must type in a valid number in
  6379.       the range
  6380.             Manual reference: Section V.5
  6381.             Examples: EC Pick two numbers?$_ ][ SE n1=$N n2=$N
  6382.                       EC $_Their sum is
  6383.             Internal parameters: ?Length, ?Size
  6384.             See also: SEt, ?Length, ?Size, QUery, AT, MN, $Q or $?
  6385.  
  6386.  
  6387.       Chapter VIII:COMMAND REFERENCE                            Page 118
  6388.  
  6389.  
  6390.  
  6391.  
  6392.                         Documentation for BATUTIL, Version 4.0
  6393.  
  6394.  
  6395.       ----------------------------------------------------------------------
  6396.       $Q or $? in SEt command    Input: US, BU       Output: EN
  6397.             Parameters: None
  6398.             In the midst of a SEt string, $Q, and $? pause to get a string
  6399.       input from the user and that string then replaces the $*.  $Q uses a
  6400.       standard (===>) prompt and standard colors.  $? allows you to set colors
  6401.       with the AT/MN commands and puts no special prompt in.
  6402.             Manual reference: Section V.5
  6403.             Examples: batutil {EC What is your name?$_}{SE name=$Q}
  6404.             Internal parameters: ?Length, ?Size
  6405.             See also: ?Length, ?Size, QUery, AT, MN, $N, $¿
  6406.       ----------------------------------------------------------------------
  6407.       $R and $R(...)  in diverse commands   Input: FI, CM    Output: EN, DI
  6408.             Parameters: filename
  6409.             The first reference to $R must include a filename to use;
  6410.       subsequent $R's will read successive lines from the file storing the
  6411.       current line number if $9.  $% is set to 1 if the end of the file has
  6412.       been reached.  To restart reading from the current file, just include a
  6413.       minus sign in front of the filename; to choose the file but not read a
  6414.       line, place a plus sign in front.
  6415.             Manual reference: Section VI.5
  6416.             Examples: IO - [] $R(foobar.txt) [] if $% > 0 then goto fileerror
  6417.             See also: IOerror, $%, $R(con)
  6418.       ----------------------------------------------------------------------
  6419.       $R(con) in diverse commands   Input: SY     Output: EN, DI
  6420.             Parameters: none
  6421.             This is just like $R but if the file read from is "con" then the
  6422.       screen is read instead.  $9 is the number of characters to be read and
  6423.       must be set to a number from 1 to 255.  $7 is the row number and $8 the
  6424.       column number.  If the number has a + or - in front or is 0 (the
  6425.       default), the row/column is relative to the current cursor position.
  6426.       Otherwise, they are absolute.  Subsequent calls to $R treat it as if con
  6427.       were the file name until it is changed with a $R(...).
  6428.             Manual reference: Section VI.5
  6429.             Examples:   #T C [] $9=$r [] $7=-1 [] $8=1 [] $1=$R(con)
  6430.             See also: IOerror, $%, $R(...)
  6431.       ----------------------------------------------------------------------
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.       Chapter VIII:COMMAND REFERENCE                            Page 119
  6442.  
  6443.  
  6444.  
  6445.  
  6446.                         Documentation for BATUTIL, Version 4.0
  6447.  
  6448.  
  6449.       $Rtranslate   {}          Input: CM           Output: IN
  6450.             Parameters: + or -
  6451.             By default, when files are read in with the $R metastring,
  6452.       metastring translation does not take place.  You can turn such
  6453.       translation on with {$R +} and can turn it off again with {$R -}.
  6454.             Manual reference: Section VI.5
  6455.             Examples: batutil {$R+}{$1=$R(foobar.txt)}
  6456.             See also: $R, $R(...), $Wtranslate
  6457.       ----------------------------------------------------------------------
  6458.       $s in diverse cmds          Input: CM           Output: EN, DI
  6459.             Parameters: (subcmd,string,extra params)
  6460.             Subcommand  Purpose                  Additional parameter(s)
  6461.                U           Uppercase                  NONE
  6462.                L           Lowercase                  NONE
  6463.                S           Size                       NONE
  6464.                P           Position                   substring
  6465.                C           Copy                       start, length
  6466.                D           Delete                     start, length
  6467.                I           Insert                     substring, position
  6468.                W           Word                       word number (0=total)
  6469.                T           Trim                       NONE
  6470.                F           Format                     L,R,C + length
  6471.                #           count                      character
  6472.             Manual reference: Section VI.2
  6473.             Examples: batutil {$1=$Q}{$1=$s(W,$1,0)}{EC $1 words}
  6474.             See also: ECho, SEt
  6475.       ----------------------------------------------------------------------
  6476.       $V in diverse cmds          Input: CM           Output: EN, DI
  6477.             Parameters: arithmetic string in ()
  6478.             This will eValuate a numeric expression using +, -, *, /, \ and **
  6479.       where ** is power, / is integer division and \ is the mod function.
  6480.       Nested parenthesis are understood.
  6481.             Manual reference: Section VI.3
  6482.             Examples: batutil {FOR $1=1 TO 10 FOR $2=1 TO 10 echoln $V($1*$2)}
  6483.             See also: ECho, SEt
  6484.       ----------------------------------------------------------------------
  6485.       $Wtranslate   {}          Input: CM           Output: IN
  6486.             Parameters: + or -
  6487.             By default, when files are written to with the $W metastring,
  6488.       metastring translation takes place.  You can turn such translation off
  6489.       with {$W +} and can turn it back on again with {$W -}.
  6490.             Manual reference: Section VI.5
  6491.             Examples: $W - [] ec $E >> foobar.txt
  6492.             See also: >, >>, $Rtranslate
  6493.  
  6494.  
  6495.       Chapter VIII:COMMAND REFERENCE                            Page 120
  6496.  
  6497.  
  6498.  
  6499.  
  6500.                         Documentation for BATUTIL, Version 4.0
  6501.  
  6502.  
  6503.       ----------------------------------------------------------------------
  6504.       $X or $x  in diverse cmds   Input: EN           Output: EN, DI
  6505.             Parameters: Variable name in ()
  6506.             $x(varname) searches the environment for a variable varname
  6507.       and if it finds it replaces $x(varname) by it value.  Otherwise
  6508.       $x(varname) is replaced by the empty string.  $X translates the
  6509.       value of the variable using metastring translation.  Applies to
  6510.       ECho, PRetty, MEnu, SEt commands.
  6511.             Manual reference: Section III.2
  6512.             Examples: batutil {EC your PATH is $x(path)}
  6513.             Internal parameters: $Translate
  6514.             See also: ECho, FEcho, PRetty, FPretty, MEnu, FMenu, SEt
  6515.       ----------------------------------------------------------------------
  6516.       $Z in diverse cmds             Input: CM     Output: EX, DI, EN
  6517.             Parameters: (XXXX:YYYY) where XXXX:YYYY is a hex memory address
  6518.             This metastring only works if hacker mode is turned on.  The
  6519.       command
  6520.             SEt $Z(XXXX:YYYY)=WW
  6521.       will write that hex value to memory and
  6522.             ECho $Z(XXXX:YYYY)
  6523.       will read that memory address and echo it to the screen (in hex).
  6524.             Manual reference: Section VI.13
  6525.             Examples: batutil {SEt $Z(XXXX:YYYY)=WW}
  6526.             Internal parameters: HACKER
  6527.             See also: HACKER, $z
  6528.       ----------------------------------------------------------------------
  6529.       $z in diverse cmds             Input: CM     Output: EX, DI, EN
  6530.             Parameters: YYYY where YYYY is a hex port number
  6531.             This metastring only works if hacker mode is turned on.  The
  6532.       command
  6533.             SEt $z(YYYY)=WW
  6534.       will write that hex value to the port and
  6535.             ECho $z(YYYY)
  6536.       will read that port and echo it to the screen (in hex).
  6537.             Manual reference: Section VI.13
  6538.             Examples: batutil {SEt $z(YYYY)=WW}
  6539.             Internal parameters: HACKER
  6540.             See also: HACKER, $Z
  6541.       ----------------------------------------------------------------------
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.       Chapter VIII:COMMAND REFERENCE                            Page 121
  6550.  
  6551.  
  6552.  
  6553.  
  6554.                         Documentation for BATUTIL, Version 4.0
  6555.  
  6556.  
  6557.       $¿ in SEt command       Input: US, BU               Output:  EN
  6558.             Parameters: None
  6559.             In the midst of a SEt string, $Q and $? pause to get a string
  6560.       input from the user and that string then replaces the $¿.
  6561.       Unlike $Q and $? the input is not echoed to the screen(passwode mode).
  6562.       Set colors with the AT/MN commands.  No special prompt is put in.
  6563.             Manual reference: Section V.5
  6564.             Examples: batutil {EC What is your password?$_}{SE name=$¿}
  6565.             Internal parameters: ?Length, ?Size
  6566.             See also: ?Length, ?Size, QUery, AT, MN, $N, $Q
  6567.       ----------------------------------------------------------------------
  6568.       $<letter> in diverse cmds   Input: SY           Output: EN, DI
  6569.             Parameters: $ followed by $,t,p,d,v,n,g,l,b,q,h,e,_,P,T,M,D,Y,
  6570.                W,E,J,H,m,S,^,(,),`,'
  6571.             In various places (ECho, PRetty, MEnu, SEt) $<letter> is
  6572.       translated according to DOS prompt metastring rules, SEND/STACKEY
  6573.       extensions and some special BATUTIL extensions.  See the list in
  6574.       Section III.2.
  6575.             Manual reference: Section III.2
  6576.             Examples: batutil {EC Today is $E}
  6577.             Internal parameters: $Translate
  6578.             See also: ECho, FEcho, PRetty, FPretty, MEnu, FMenu, SEt
  6579.       ----------------------------------------------------------------------
  6580.       $Translate      {}          Input: CM           Output: IN
  6581.             Parameters: none or -
  6582.             {$T -} sets an internal flag turning off translation of $letter
  6583.       metastrings in the set, echo and menu commands.  $T undoes the effect
  6584.       of $T -.  BATUTIL does not keep internal flags from one running to the
  6585.       next so $ translation is turned back on for each new loading.
  6586.             Manual reference: Section III.2
  6587.             Examples: batutil {$T-}{EC $E}{$T}{EC $Shi $E}
  6588.               would echo "$E hi July 23, 1988" on July 23, 1988
  6589.             See also: ^Translate, QUery
  6590.       ----------------------------------------------------------------------
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.       Chapter VIII:COMMAND REFERENCE                            Page 122
  6604.  
  6605.  
  6606.  
  6607.  
  6608.                         Documentation for BATUTIL, Version 4.0
  6609.  
  6610.  
  6611.       ++ and --       {}          Input: CM           Output: IN, EV
  6612.             If the string following ++ or -- is one of the thirty BATUTIL
  6613.       internal variables, $1,...,$0,$é,...,$ò then this is translated to
  6614.             set $1=$V($1+1)
  6615.       or
  6616.             set $1=$V($1-1)
  6617.       Otherwise, if the string after ++ is string, it is translated to
  6618.             set string=$V($x(string)+1)
  6619.       or
  6620.             set string=$V($x(string)-1)
  6621.             Manual reference: Sections V.4, VI.3
  6622.             Examples: batutil {$1=0}{fordir $2 in () ++ $1}{EC $1}
  6623.             See also: $1=,$V
  6624.       ----------------------------------------------------------------------
  6625.       > or >>  after ECho cmd     Input: CM       Output: EX
  6626.             Parameters: filename afterwards
  6627.                 EC some string> somefile
  6628.       as an INcluded command only will echo that string to the file somefile.
  6629.       If a single > is used, the file is deleted if it already exists unless a
  6630.       ? is placed before the name.  In that case, if the file exists a
  6631.       <A>ppend, <O>verwrite, <C>ancel? dialog will popup.  If >> is used then
  6632.       append takes place.
  6633.             Manual reference: Section VI.5
  6634.             Examples: echo $E at $H:$M >> logfile
  6635.                (INcluded commands only)
  6636.             See also: $Wtranslate, STdout
  6637.       ----------------------------------------------------------------------
  6638.       ? or !   HELP   Initial Parameter               Output:  IN
  6639.             Parameters: Only first two letters count
  6640.             If ? (not in {} or []) is the first parameter on the command
  6641.       line, help is called and the rest of the command line is ignored
  6642.       except that if the first two letters (or first two letters after a
  6643.       { or [) match a command, help for that command is displayed rather
  6644.       than the main help menu.  For help to be available, batutil.hlp
  6645.       must be in the default directory or in your path.
  6646.             ! works the same as ? except that ? has some fancy visual effects
  6647.       and ! suppresses them.
  6648.             Manual reference: Section I.3
  6649.             Examples: batutil ? getkey
  6650.       ----------------------------------------------------------------------
  6651.  
  6652.  
  6653.  
  6654.  
  6655.  
  6656.  
  6657.       Chapter VIII:COMMAND REFERENCE                            Page 123
  6658.  
  6659.  
  6660.  
  6661.  
  6662.                         Documentation for BATUTIL, Version 4.0
  6663.  
  6664.  
  6665.       ?Length         {}          Input: CM           Output: IN
  6666.             Parameters: 1 to 255 (default is 80)
  6667.             Adjusts the maximum length of user input to a $Q or $? in a SEt
  6668.       command
  6669.             Manual reference: Section V.5
  6670.             Examples: batutil {EC Enter your name}{?L 30}{SEt foo=$Q}
  6671.             See also: ?Size, SEt
  6672.       ----------------------------------------------------------------------
  6673.       ?Size           {}          Input: CM           Output: IN
  6674.             Parameters: 1 to 80
  6675.             Adjusts the size of the edit box for the $Q or $? in a SEt
  6676.       command
  6677.             Values: 1 to 80 (default is 50); if ?L is less than ?S, then ?S
  6678.       is adjusted downwards
  6679.             Manual reference: Section V.5
  6680.             Examples: batutil {EC Enter your name}{?L 30}{?S 20}{SEt foo=$Q}
  6681.             See also: ?Length, SEt
  6682.       ----------------------------------------------------------------------
  6683.       @Ansi           []/{}       Input: SY           Output: EL
  6684.             Parameters: None
  6685.             Determines if there is an ANSI compatible screen driver present
  6686.       (by saving the current screen and using an ANSI command to move the
  6687.       cursor and checking that the cursor really moved).
  6688.             Values: 0 = No ANSI driver; 1 = ANSI driver found
  6689.             Manual reference: Section II.4
  6690.             Examples: batutil [@A]
  6691.       ----------------------------------------------------------------------
  6692.       @Disk           []/{}       Input: SY           Output: EL
  6693.             Parameters: Drive letter; no parameter means default drive
  6694.             Free disk space on the specified or default drive in units of 8K
  6695.       rounded down with 199 returned for 1592K or more free
  6696.             Values: 0 to 199; 239 means invalid drive letter or drive not
  6697.       ready
  6698.             Manual reference: Section II.3
  6699.             Examples: batutil [@D C]
  6700.             See also: #Disk
  6701.       ----------------------------------------------------------------------
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.  
  6709.  
  6710.  
  6711.       Chapter VIII:COMMAND REFERENCE                            Page 124
  6712.  
  6713.  
  6714.  
  6715.  
  6716.                         Documentation for BATUTIL, Version 4.0
  6717.  
  6718.  
  6719.       @Env            []/{}       Input: SY           Output: EL
  6720.             Parameters: None
  6721.             Number of bytes of free environment with 199 returned if there
  6722.       are 199 or more free bytes.  This is information about the current
  6723.       ACTIVE DOS environment.
  6724.             Values: 1 to 199
  6725.             Manual reference: Section II.3
  6726.             Examples: batutil [@E]
  6727.             See also: #Env
  6728.       ----------------------------------------------------------------------
  6729.       @Floppy         []/{}       Input: SY           Output: EL
  6730.             Parameters: None
  6731.             For use in systems with a single floppy drive which can be either
  6732.       drive A or B
  6733.             Values: 0 = other than one floppy; 1 = single floppy currently
  6734.       set to drive A; 2= single floppy currently set to drive B
  6735.             Manual reference: Section II.5
  6736.             Examples: batutil [@F]
  6737.             See also: #Floppy
  6738.       ----------------------------------------------------------------------
  6739.       @Intel          []/{}       Input: SY           Output: EL
  6740.             Parameters: None
  6741.             Returns information on the type of math coprocessor present
  6742.             Values: 0 = no '87 chip, 1 = 8087, 2 = 287, 3 = 387, 4 = 487
  6743.             Manual reference: Section II.5
  6744.             Examples: batutil [@I]
  6745.             See also: #Intel
  6746.       ----------------------------------------------------------------------
  6747.       @Lim            []/{}       Input: SY           Output: EL
  6748.             Parameters: None
  6749.             Returns the amount of free EMS memory in units of 16K rounded
  6750.       down up to 3184K or more which returns 199
  6751.             Values: 0 to 199
  6752.             Manual reference: Section II.3
  6753.             Examples: batutil [@L]
  6754.             See also: LIm, #Lim, #Mem, #Xtended, @Mem, @Xtended
  6755.       ----------------------------------------------------------------------
  6756.       @Mem            []/{}       Input: SY           Output: EL
  6757.             Parameters: None
  6758.             Free DOS memory in units of 4K rounded down
  6759.             Values: 0 to 160
  6760.             Manual reference: Section II.3
  6761.             Examples: batutil [@M]
  6762.             See also: #Lim, #Mem, #Xtended, @Lim, @Xtended
  6763.  
  6764.  
  6765.       Chapter VIII:COMMAND REFERENCE                            Page 125
  6766.  
  6767.  
  6768.  
  6769.  
  6770.                         Documentation for BATUTIL, Version 4.0
  6771.  
  6772.  
  6773.       ----------------------------------------------------------------------
  6774.       @Prn            []/{}       Input: SY           Output: EL
  6775.             Parameters: printer number from 1 to 3, no parameter defaults to
  6776.       LPT1
  6777.             Returns information about the status of the printer whose number
  6778.       is given as a parameter
  6779.             Values: returns information about printer as follows:
  6780.                0 = printer status OK
  6781.                1 = paper out error
  6782.                2 = I/O error
  6783.                3 = Timeout error
  6784.                4 = invalid printer
  6785.                5 = other printer error
  6786.             Manual reference: Section II.5
  6787.             Examples: batutil [@P 2]
  6788.             See also: #Prn
  6789.       ----------------------------------------------------------------------
  6790.       @Terminal       []/{}       Input: SY           Output: EL
  6791.             Parameters: None
  6792.             Returns the active monitor
  6793.             Values: 0 = monochrome (including Hercules monographics);
  6794.                1= graphics monitor (CGA, EGA, VGA)
  6795.             Manual reference: Section II.4
  6796.             Examples: batutil  [@T]
  6797.             See also: #Terminal, #Altmon, #Whichmon
  6798.       ----------------------------------------------------------------------
  6799.       @Xtended        []/{}       Input: SY           Output: EL
  6800.             Parameters: None
  6801.             Returns the amount of free extended memory in units of 16K.
  6802.       Since there is no standard for extended memory, BATUTIL may think that
  6803.       some memory which is used by an application is actually free.  It takes
  6804.       into account any VDISK compatible usage.
  6805.             Values: 0 to 199
  6806.             Manual reference: Section II.3
  6807.             Examples: batutil [@X]
  6808.             See also: #Lim, #Mem, #Xtended, @Lim, @Mem
  6809.       ----------------------------------------------------------------------
  6810.  
  6811.  
  6812.  
  6813.  
  6814.  
  6815.  
  6816.  
  6817.  
  6818.  
  6819.       Chapter VIII:COMMAND REFERENCE                            Page 126
  6820.  
  6821.  
  6822.  
  6823.  
  6824.                         Documentation for BATUTIL, Version 4.0
  6825.  
  6826.  
  6827.       ^Translate      {}          Input: CM           Output: IN
  6828.             Parameters: None or -
  6829.             {^T -} sets an internal flag turning off translation of ^letter
  6830.       metastrings in the set, echo and menu commands.  ^T undoes the effect
  6831.       of ^T -.  BATUTIL does not keep internal flags from one running to the
  6832.       next so ^ translation is turned back on for each new loading.
  6833.             Manual reference: Section III.2
  6834.             Examples: batutil {^T -}{EC ^A}{^T}{EC ^A}
  6835.               would echo the letters ^A and then happy face (= Ctrl-A)
  6836.             See also: $Translate, QUery
  6837.       ----------------------------------------------------------------------
  6838.       ADdpath         []/{}       Input: CM           Output: EN,EL
  6839.             Parameters: list of paths separated by spaces; $p or $P processed
  6840.             Adds the indicated paths to the PATH unless they are already in
  6841.       the path statement.  $p is replaced by the current path and $P by the
  6842.       current path with a trailing backslash.
  6843.             Values: 0 to 199 - number of directories actually added to the
  6844.       PATH
  6845.             Manual reference: Section V.8
  6846.             Examples: batutil [AD $p]
  6847.       would add the current directory to the path
  6848.             See also: DElpath, PAthedit, EDitenv
  6849.       ----------------------------------------------------------------------
  6850.       ASciiread       []/{}       Input: US           Output: EL
  6851.             Parameters: None
  6852.             Waits for a keystroke and reports the ASCII value of the
  6853.       key struck (0 for extended keys like <F1>)
  6854.             Values: 0 to 255
  6855.             Manual reference: Section IV.6
  6856.             Examples: batutil [AS]
  6857.             Internal parameters: NFlush (determines whether the keyboard is
  6858.       flushed)
  6859.             See also: SCanread, GEtkey, NFlush
  6860.       ----------------------------------------------------------------------
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867.  
  6868.  
  6869.  
  6870.  
  6871.  
  6872.  
  6873.       Chapter VIII:COMMAND REFERENCE                            Page 127
  6874.  
  6875.  
  6876.  
  6877.  
  6878.                         Documentation for BATUTIL, Version 4.0
  6879.  
  6880.  
  6881.       ATtribute       {}          Input: CM           Output: IN
  6882.             Parameters: Hex number from 0 to FF with optional leading $;
  6883.       special meaning if the parameter is T followed by a one or two
  6884.       digit number.
  6885.             BATUTIL keeps an internal attribute used when EChoing, for
  6886.       shadows in MEnus, when the CLs command clears the screen,for the $?
  6887.       command.  It defaults to $1E (yellow on blue).  The {AT xx} changes it.
  6888.       See Section III.3 for a list of attributes. Two special values do not
  6889.       have their default meaning: $55 uses the attribute at the cursor at the
  6890.       time that ECho is called; $66 write with no change in the underlying
  6891.       attributes.  {AT Tnm} affects how the time is displayed in a
  6892.       {GEtkey WAit...} command: n from 0-3 (default 3) affects how much
  6893.       time is adjusted and m from 1 to 8, the units used in 1/4 seconds
  6894.       (default is 4; i.e. 1 second).
  6895.             Manual reference: Section III.3, Section IV.5
  6896.             Examples: batutil {EC hello$S}{AT $4F}{EC there}
  6897.       would echo "hello " in yellow on blue and "there" in white on red
  6898.             See also: MNattribute, ECho, PRetty, CLs, EOline, ROw, COl
  6899.       ----------------------------------------------------------------------
  6900.       BEcho           {}          Input: CM, BU       Output: DI
  6901.             Parameters: string to be echoed (special handling of leading
  6902.       ~ and trailing ~ or ^)
  6903.             Echoes a string with large (8x8) characters to the screen
  6904.       with metastring translation and an automatic big CR.  Colors
  6905.       determined by the AT and MN flags (defaulting to $1E on color and
  6906.       $07 on monochrome).  A final ^ on the string suppress the big CR.
  6907.       Dot patterns for letters replaced by space for off dots and ASCII
  6908.       219 for on.  This can be changed by the BIgchar command.  See that
  6909.       description for the treatment of leading/trailing  ~'s.
  6910.             Manual reference: Section III.6
  6911.             Examples: batutil {BE hi there!}
  6912.             Internal parameters: AT, MN, BI, $T, ^T
  6913.             See also: ECho, PRetty, BPretty, ATttribute, MNattribute,
  6914.                 BIgchar
  6915.       ----------------------------------------------------------------------
  6916.       BEGIN             BUSIC keyword
  6917.             Used as the start of a multiple command clause in IF...THEN,
  6918.       IF...THEN...ELSE, FOR, FORDIR and WHILE commands
  6919.             Manual reference: Sections VI.8, VI.9, VI.10
  6920.             Examples: FORDIR $1 IN () DO BEGIN [] ++ $2 [] EC $2:$1$_ [] END
  6921.             See also: IF, THEN, ELSE, END, FOR, FORDIR, WHILE
  6922.       ----------------------------------------------------------------------
  6923.  
  6924.  
  6925.  
  6926.  
  6927.       Chapter VIII:COMMAND REFERENCE                            Page 128
  6928.  
  6929.  
  6930.  
  6931.  
  6932.                         Documentation for BATUTIL, Version 4.0
  6933.  
  6934.  
  6935.       BIgchar         {}          Input: CM           Output: IN
  6936.             Parameters: one or two ASCII characters.  Each character can
  6937.       be replaced by a number from 01 to 255 (use leading 0 for numbers
  6938.       below 10) or a hex number preceded by a $.
  6939.             BEcho and BPretty display large letters based on the dot
  6940.       patterns stored in ROM.  On dots are replaced by an "on character"
  6941.       and off dots by an "off character" which default to ASCII 219
  6942.       (solid block) and ASCII 32 (space).  BIgchar allows you to change
  6943.       that - the first parameter is the on character and the second the
  6944.       off character.  If the on character is ASCII 255, then the on
  6945.       character displayed is the same as the character being displayed.
  6946.       By default for BEcho, the background character is different from
  6947.       space is displayed on the entire line; leading and trailing ~'s
  6948.       will suppress that.
  6949.             Manual reference: Section III.6
  6950.             Examples: batutil {BI $20 01}{BP @1FH@1Ei}
  6951.             See also: BEcho, BPretty
  6952.       ----------------------------------------------------------------------
  6953.       BOx             {}          Input: CM, BU       Output: DI
  6954.             Parameters: top bottom left right [frame movecur]
  6955.             Displays a box on the screen.  The four required parameters set
  6956.       the corners of box.  The color used is that set by the AT (MN command)
  6957.       with the foreground color used for the frame.  By default the frame is a
  6958.       single line but this can be changed with the frame parameter to one of
  6959.       five other possibilities.  By default, the cursor moves to just inside
  6960.       the frame but using N for the fifth or sixth parameter will not move the
  6961.       cursor.
  6962.             Manual reference: Section III.4
  6963.             Examples: batutil {SH +}{AT 3B}{$8=}{BO 8 13 24 52 2}
  6964.             Internal parameters: SH, $8, AT, MN
  6965.             See also: ECho
  6966.       ----------------------------------------------------------------------
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.  
  6980.  
  6981.       Chapter VIII:COMMAND REFERENCE                            Page 129
  6982.  
  6983.  
  6984.  
  6985.  
  6986.                         Documentation for BATUTIL, Version 4.0
  6987.  
  6988.  
  6989.       BPretty         {}          Input: CM, BU       Output: DI
  6990.             Parameters: string to be echoed with embedded @ commands
  6991.       (special handling of trailing ~)
  6992.             Echoes a string with large (8x8) characters to the screen
  6993.       with metastring translation and an automatic big CR.  Colors
  6994.       determined by the AT and MN flags (defaulting to $1E on color and
  6995.       $07 on monochrome).  A final ^ on the string suppress the big CR.
  6996.       Dot patterns for letters replaced by space for off dots and ASCII
  6997.       219 for on.  This can be changed by the BIgchar command. Colors can
  6998.       be changed by @'s in the string to be printed; see the PRetty
  6999.       command.
  7000.             Manual reference: Section III.6
  7001.             Examples: batutil {BP @1FH@1Ei}
  7002.             Internal parameters: AT, MN, BI, $T, ^T
  7003.             See also: ECho, PRetty, BEcho, ATttribute, MNattribute,
  7004.                 BIgchar
  7005.       ----------------------------------------------------------------------
  7006.       CALL              BUSIC command
  7007.             Parameters: labelname
  7008.             Calls a subroutine.  Transfers control to the command following
  7009.       the specified labelname until a RET command is encountered at which
  7010.       point control returns to the command following the initial CALL.
  7011.       Labelnames have metastring translation done.
  7012.             Manual reference: Section VI.7
  7013.             Examples: GO foo1 [] LA foo [] --$1 [] ECho $1$_ [] RET
  7014.                           LA foo1 [] FOR $2=1 TO 7 CALL foo
  7015.             See also: GOto, LAbel, RET
  7016.       ----------------------------------------------------------------------
  7017.       CArousel        []/{}       Input: SY           Output: EL
  7018.             Parameters: None
  7019.             CArousel is special to Softlogic's SOFTWARE CAROUSEL.  It returns
  7020.       0 is CArousel isn't loaded and otherwise returns the current partition
  7021.       number from 1 to 10 (1 to 12 with Carousel 3.0)
  7022.             Values: 0 to 12
  7023.             Manual reference: Section II.2
  7024.             Examples: batutil [CA]
  7025.       ----------------------------------------------------------------------
  7026.  
  7027.  
  7028.  
  7029.  
  7030.  
  7031.  
  7032.  
  7033.  
  7034.  
  7035.       Chapter VIII:COMMAND REFERENCE                            Page 130
  7036.  
  7037.  
  7038.  
  7039.  
  7040.                         Documentation for BATUTIL, Version 4.0
  7041.  
  7042.  
  7043.       CASE              BUSIC command
  7044.             Multiple choice branch with syntax
  7045.               CASE string OF
  7046.                 choice1: cmd11
  7047.                          cmd12
  7048.                 choice2: cmd22
  7049.                     .....
  7050.               ENDCASE
  7051.             Manual reference: Section VI.8
  7052.             Examples: CASE $1 OF [] 1:$2=EGA [] 2:$2=VGA [] ENDCASE
  7053.             See also: IF, ENDCASE
  7054.       ----------------------------------------------------------------------
  7055.       CHeck           []/{}       Input: CM, SY       Output: EL
  7056.             Parameters: Path with or without trailing backslash
  7057.             Determines whether a given path is present in the system
  7058.             Values: 0 = path valid; 9 = path not found
  7059.             Manual reference: Section II.6
  7060.             Examples: batutil {CH C:\bin}
  7061.             See also: EXist
  7062.       ----------------------------------------------------------------------
  7063.       CLs             {}          Input: BU           Output: DI
  7064.             Parameters: None
  7065.             Clears the screen in the current internal attributes which are
  7066.       $1E (yellow on blue) by default on a graphics screen and $07 (normal)
  7067.       on a monochrome screen; may be changed with the AT and MN commands
  7068.             Manual reference: Section III.3
  7069.             Examples: batutil {AT $1F}{CL}
  7070.       would clear the screen in white on red (!)
  7071.             See also: ATtribute, MNattribute, EOline
  7072.       ----------------------------------------------------------------------
  7073.       COl             {}          Input: CM           Output: DI
  7074.             Parameters: One decimal number with optional +, - or T in front;
  7075.       decimal number must be between 1 and 80.
  7076.             Moves the cursor; if just a number is given the cursor is moved
  7077.       to precisely that column.  If a plus or minus precedes the number,
  7078.       then the movement is relative to the current position but wrapping
  7079.       does not take place so that, for example {CO +80} will always go to
  7080.       column 80.  {CO Txx} sets the location of where the countdown clock
  7081.       will occur with {GEtkey WAit}.
  7082.             Manual reference: Sections III.8, IV.5
  7083.             Examples: batutil {CO 5}{EC This line is indented}
  7084.                       batutil {RO 1}{EC Time Left:}{RO T1}{CO T12}{GE WA60}
  7085.             See also: ROw, CUrsor
  7086.       ----------------------------------------------------------------------
  7087.  
  7088.  
  7089.       Chapter VIII:COMMAND REFERENCE                            Page 131
  7090.  
  7091.  
  7092.  
  7093.  
  7094.                         Documentation for BATUTIL, Version 4.0
  7095.  
  7096.  
  7097.       CSent           {}          Input: None         Output: IN
  7098.             Parameters: None
  7099.             Input for GEtkey, PMatch and USername are not case sensitive by
  7100.       default; CSent will tell the next call to either of these to be case
  7101.       sensitive.  The internal flag is reset by such a call.
  7102.             Manual reference: Section IV.5
  7103.             Examples: batutil {CS}{GE Y N}{GE Y N}  ; the first call would
  7104.       require Y or N; the second would accept Y,y,N or n
  7105.             See also: GEtkey, PMatch, USername
  7106.       ----------------------------------------------------------------------
  7107.       CUrsor          {}          Input: CM           Output: DI
  7108.             Parameters: + or - required
  7109.             Turns off the Cursor if a minus is used; turns it back on if a +
  7110.       is used.  In either case, the cursor is turned back on when BATUTIL
  7111.       exits.
  7112.             Manual reference: Section III.8
  7113.             Examples: batutil {CU}{EC hit any key}{AS}
  7114.             See also: ROw, COl
  7115.       ----------------------------------------------------------------------
  7116.       DAte            []/{}       Input: None         Output: EL
  7117.             Parameters: None
  7118.             Returns the day of the month from 1 to 31
  7119.             Values: 1 to 31
  7120.             Manual reference: Section II.2
  7121.             Examples: batutil [DA]
  7122.             See also: HOur, MInute, WEekday, MOnth, YEar
  7123.       ----------------------------------------------------------------------
  7124.       DElpath         []/{}       Input: CM           Output: EN, EL
  7125.             Parameters: list of paths separated by spaces; $p or $P processed
  7126.             Deletes the indicated paths from the PATH if they are in the path
  7127.       statement.  $p is replaced by the current path and $P by the current
  7128.       path with a trailing backslash.
  7129.             Values: 0 to 199 - number of directories actually removed from the
  7130.       PATH
  7131.             Manual reference: Section V.8
  7132.             Examples: batutil [DE $p] would remove the current directory from
  7133.       the path
  7134.             See also: ADdpath, PAthedit, EDitenv
  7135.       ----------------------------------------------------------------------
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.       Chapter VIII:COMMAND REFERENCE                            Page 132
  7144.  
  7145.  
  7146.  
  7147.  
  7148.                         Documentation for BATUTIL, Version 4.0
  7149.  
  7150.  
  7151.       DO                BUSIC keyword
  7152.             Required keyword in WHILE loop, optional keyword in FOR loops.
  7153.             Manual reference: Section VI.9
  7154.             Examples: WHILE $1 < 8 DO BEGIN [] ECHOLN $1 [] ++ $1 [] END
  7155.                       FOR $1=1 TO 7 DO ECHOLN $1
  7156.             See also: WHILE, FOR, FORDIR, UNTIL
  7157.       ----------------------------------------------------------------------
  7158.       DOs             []/{}       Input: None         Output: EL
  7159.             Parameters: None, 4, N, S, F, B, L, W
  7160.             Returns the DOS Version times ten rounded downwards.
  7161.             "DOS 4" returns 1 if 4DOS is loaded in memory and 0 if not
  7162.             "DOS N" returns 1 if NDOS is loaded in memory and 0 if not
  7163.             "DOS S" returns 1 if share is loaded in memory and 0 if not
  7164.             "DOS B/F/L" return the number of buffers/files handles/maximum
  7165.                logical drives
  7166.             "DOS W" returns 0 if Windows is not loaded, 1 if running in DOS
  7167.                box of Windows in standard or real mode, 2 in a DOS box of
  7168.                Windows/386 2.x and 3 in Windows 3.x in enhanced mode
  7169.             Values: 20,21,30,31,32,33,40 (should work on later versions)
  7170.                     0,1 for "DOS 4/N/S"
  7171.                     0,.. for "DOS B/F/L"
  7172.                     0,1,2,3 for "DOS W"
  7173.             Manual reference: Section II.3
  7174.             Examples: batutil [DO]
  7175.       ----------------------------------------------------------------------
  7176.       DRive           []/{}       Input: None         Output: EL
  7177.             Parameters: None
  7178.             DRive returns the current drive with 0=A, 1=B, ...., 25=Z. This is
  7179.       the drive as DOS reports it so if SUBST is in effect, the subst letter
  7180.       will be used.
  7181.             Values: 0 to 25
  7182.             Manual reference: Section II.3
  7183.             Examples: batutil [DR]
  7184.             See also: #Disk, @Disk
  7185.       ----------------------------------------------------------------------
  7186.       DView           []/{}       Input: SY           Output: EL
  7187.             Parameters: None
  7188.             Dview is special to Quarterdeck's DESQVIEW multitasking
  7189.       software.  It returns 0 is DesqView isn't loaded and otherwise
  7190.       returns the current partition number from 1 to 199.
  7191.             Values: 0 to 199
  7192.             Manual reference: Section II.2
  7193.             Examples: batutil [DV]
  7194.       ----------------------------------------------------------------------
  7195.  
  7196.  
  7197.       Chapter VIII:COMMAND REFERENCE                            Page 133
  7198.  
  7199.  
  7200.  
  7201.  
  7202.                         Documentation for BATUTIL, Version 4.0
  7203.  
  7204.  
  7205.       E  European Date Mode   Initial Parameter            Output:  IN
  7206.             Parameters: None
  7207.             If the first parameter on the command line or in BU@ is E (or e),
  7208.       then European dates are turned on for $E and $d and for parameter
  7209.       parsing for $J(...), etc. In $J(2/1/92), by default, the date is
  7210.       February 1, 1992 but when E is turned on, it is January 2.
  7211.             Manual reference: Section I.3
  7212.             Examples: batutil E {EC $d}
  7213.       ----------------------------------------------------------------------
  7214.       ECho            {}          Input: CM, BU       Output: DI
  7215.             Parameters: string to be echoed
  7216.             Echoes a string to the screen with metastring translation but no
  7217.       automatic CR/LF.  Colors determined by the AT and MN flags (defaulting
  7218.       to $1E on color and $07 on monochrome).  Can echo to STDOUT if the
  7219.       STdout command is used. PRetty gives more color control.
  7220.             Manual reference: Section III.3
  7221.             Examples: batutil {EC hi there!}
  7222.             Internal parameters: AT, MN, ST, $T, ^T
  7223.             See also: FEcho, PRetty, FPretty, ATttribute, MNattribute,
  7224.                 STdout,BEcho, ECHOLN, BOx
  7225.       ----------------------------------------------------------------------
  7226.       ECHOLN          {}          Input: CM, BU       Output: DI
  7227.             Parameters: string to be echoed
  7228.             Echoes a string with trailing CR/LF.  Internally
  7229.                 echoln ....
  7230.       is translated to
  7231.                 echo ....$_
  7232.       This command does NOT have a minimal truncation.
  7233.             Manual reference: Section III.3
  7234.             Examples: batutil {ECHOLN hi there!}
  7235.             Internal parameters: AT, MN, ST, $T, ^T
  7236.             See also: FEcho, PRetty, FPretty, ATttribute, MNattribute,
  7237.                 STdout,BEcho, ECho
  7238.       ----------------------------------------------------------------------
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.       Chapter VIII:COMMAND REFERENCE                            Page 134
  7252.  
  7253.  
  7254.  
  7255.  
  7256.                         Documentation for BATUTIL, Version 4.0
  7257.  
  7258.  
  7259.       EDitenv         {}          Input: CM, SY, US   Output: EN
  7260.             Parameters: Optional Environment variable
  7261.             With no parameter, this command calls up a full screen listing of
  7262.       all variables in the environment with directions on how to edit
  7263.       them.  If a single word is given as a parameter, you can edit the
  7264.       string with that value if there is one or you can enter the value
  7265.       of a new variable. Lengths are limited to 255 bytes (rather than
  7266.       DOS' 127).
  7267.             Manual reference: Section V.10
  7268.             Examples: batutil {ED prompt}
  7269.             Internal parameters: NBeep
  7270.             See also: SEt, PAthedit, NBeep
  7271.       ----------------------------------------------------------------------
  7272.       ELSE              BUSIC keyword
  7273.             Keyword used as part of an IF...THEN...ELSE construction
  7274.             Manual reference: Section VI.8
  7275.             Examples: IF $1=3 THEN GOto case3 ELSE CALL case2
  7276.             See also: IF, THEN, BEGIN, END, CASE
  7277.       ----------------------------------------------------------------------
  7278.       END               BUSIC keyword
  7279.             Keyword paired with BEGIN in IF...THEN, IF...THEN...ELSE, FOR,
  7280.       FORDIR and WHILE
  7281.             Manual reference: Sections VI.8, VI.9, VI.10
  7282.             Examples: FORDIR $1 IN () DO BEGIN [] ++ $2 [] EC $2:$1$_ [] END
  7283.             See also: IF, THEN, ELSE, BEGIN, FOR, FORDIR, WHILE
  7284.       ----------------------------------------------------------------------
  7285.       ENDCASE           BUSIC keyword
  7286.             Keyword paired with CASE
  7287.             Manual reference: Section VI.8
  7288.             Examples: CASE $1 OF [] 1:$2=EGA [] 2:$2=VGA [] ENDCASE
  7289.             See also: IF, CASE
  7290.       ----------------------------------------------------------------------
  7291.       ENvrep          {}          Input: SY           Output: DI
  7292.             Parameters: None
  7293.             Gives a report on the screen of the total size and free space of
  7294.       the environment, its location in memory and a listing of all strings
  7295.       with their lengths
  7296.             Manual reference: Section V.2
  7297.             Examples: batutil {EN}
  7298.       ----------------------------------------------------------------------
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.       Chapter VIII:COMMAND REFERENCE                            Page 135
  7306.  
  7307.  
  7308.  
  7309.  
  7310.                         Documentation for BATUTIL, Version 4.0
  7311.  
  7312.  
  7313.       EOline          {}          Input: CM           Output: DI
  7314.             Parameters: None or +
  7315.             {EO} erases to the end of the line in the current attributes as
  7316.       set with AT or MN; {EO +} erase the entire line.  {EO} does not change
  7317.       the cursor position; {EO +} moves the cursor to column 1.
  7318.             Manual reference: Section III.3
  7319.             Examples: batutil {RO -5}{EO +}{CO 5}{EC hi}
  7320.             Internal parameters: AT, MN
  7321.             See also: ATtribute, MNattribute, CLs
  7322.       ----------------------------------------------------------------------
  7323.       ERrorlevel      []/{}       Input: CM           Output: EL
  7324.             Parameters: Decimal number or Hex number preceded by $$ or
  7325.       $x(environmental variable)
  7326.             This allows the setting of errorlevel to a given number.
  7327.             Values: 0 to 199
  7328.             Manual reference: Section II.9
  7329.             Examples: batutil {EC Yes or No?}{GE Y N}{EC $_Thanks!}{ER $(RC)}
  7330.             See also: RUn
  7331.       ----------------------------------------------------------------------
  7332.       EXist           []/{}       Input: CM,SY        Output: EL, EN
  7333.             Parameters: A single filename without wildcards
  7334.             A powerful extension of DOS' "if exist".  If filename has no path
  7335.       or drive, the possible responses are 0 = file exists in default
  7336.       directory; 1 = file exists on path (directory will be given in FDIR;
  7337.       see FDIR below); 2 = file doesn't exist on path.  If the filename has a
  7338.       drive or path responses are 0 = file exists; 2 = file does not exist; 9
  7339.       = path invalid.  Possible errors in 23x range - see chapter IX.
  7340.       If the 'file' is a device then FDIR is set to IS_A_DEVICE.
  7341.             Values: 0,1,2,9
  7342.             Manual reference: Section II.6
  7343.             Examples: batutil {EX autoexec.bat}
  7344.             Internal parameters: FDIR
  7345.             See also: FDir, CHeck, NUmberfiles, MAke, TOdayfile
  7346.       ----------------------------------------------------------------------
  7347.       FCommand        {}          Input: CM, FI       Output: IN
  7348.             Parameters: filename and optional label
  7349.             {FC filename label} finds the file "filename" and searches for a
  7350.       line ":label".  It then adds to the list of commands to process all
  7351.       lines from the one after that label until the next line starting with
  7352.       ":".
  7353.             Manual reference: Section I.5
  7354.             Examples: batutil {FC %0 foo}
  7355.             Internal parameters: %0
  7356.             See also: INclude
  7357.  
  7358.  
  7359.       Chapter VIII:COMMAND REFERENCE                            Page 136
  7360.  
  7361.  
  7362.  
  7363.  
  7364.                         Documentation for BATUTIL, Version 4.0
  7365.  
  7366.  
  7367.       ----------------------------------------------------------------------
  7368.       FDir            {}          Input: CM           Output: IN
  7369.             Parameters: Variable name with leading \ treated specially
  7370.             By default if {EX ...} finds a file in the path but not in the
  7371.       default directory, then the directory of the file is stored in the
  7372.       environmental variable FDIR.  Similarly, a choice made by the user in a
  7373.       $f will place the path in the environmental variable FDIR.  {FD}
  7374.       with no parameter will suppress and {FD varname} will place it in
  7375.       the variable varname.  If varname starts with \ a trailing
  7376.       backspace is added to the path.
  7377.             Manual reference: Section II.6
  7378.             Examples: batutil {FD \PATH}{EX command.com}
  7379.             See also: EXist, $f
  7380.       ----------------------------------------------------------------------
  7381.       FEcho           {}          Input: CM, FI       Output: DI
  7382.             Parameters: filename and optional label
  7383.             {FE filename label} finds the file "filename" and searches
  7384.       for a line ":label".  It then echoes each line between that label
  7385.       and the next line starting with ":".  Full metastring translation
  7386.       takes place.  A CR/LF is echoed for each line in the file except
  7387.       for the last.
  7388.             Manual reference: Sections III.6, I.5
  7389.             Examples: batutil {FE %0 foo}
  7390.             Internal parameters: AT, MN, $T, ^T, %0
  7391.             See also: ECho, PRetty, FPretty, ATttribute, MNattribute
  7392.       ----------------------------------------------------------------------
  7393.       FKey            {}          Input: None         Output: IN
  7394.             Parameters: None
  7395.             When used before a MEnu or FMenu command, if there are 9 or fewer
  7396.       menu items, this command turns on display of F1, F2, etc to the left of
  7397.       the menu list and the function and number keys make choices
  7398.             Manual reference: Section IV.3
  7399.             Examples: batutil {FK}{FM %0 menulist}
  7400.             See also: MEnu, FMenu
  7401.       ----------------------------------------------------------------------
  7402.  
  7403.  
  7404.  
  7405.  
  7406.  
  7407.  
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.       Chapter VIII:COMMAND REFERENCE                            Page 137
  7414.  
  7415.  
  7416.  
  7417.  
  7418.                         Documentation for BATUTIL, Version 4.0
  7419.  
  7420.  
  7421.       FMenu           []/{}     Input: CM, FI, BU, US  Output: EL
  7422.             Parameters: filename and optional label
  7423.             {FM filename label} finds the file "filename" and searches
  7424.       for a line ":label".  It then processes each line between that
  7425.       label and the next line starting with ":".  The input lines up to
  7426.       one beginning with @ are treated as menu items; lines after a @ are
  7427.       treated as help text.
  7428.             Manual reference: Sections IV.2, I.5
  7429.             Examples: batutil [FM %0 menulist]
  7430.             Internal parameters: NMouse, MHeader, POp, SHadow, FKey, %0
  7431.             See also: MEnu, NMouse, MHeader, POp, SHadow, FKey
  7432.       ----------------------------------------------------------------------
  7433.       FOR               BUSIC command
  7434.             A BUSIC loop with one of two forms
  7435.                 FOR $1=1 TO 10 ....
  7436.                 FOR $1 IN (list)
  7437.       If the list has file wildcards, a file search is done.
  7438.             Manual reference: Sections VI.9, VI.10
  7439.             Examples: FOR $1=1 TO 7 DO ECHOLN $1
  7440.                       FOR $1 IN (*.EXE *.COM) DO ECHOLN $1
  7441.             See also: WHILE, UNTIL, DO, IN, TO, FORDIR
  7442.       ----------------------------------------------------------------------
  7443.       FORDIR            BUSIC command
  7444.          A BUSIC loop where the loop variable takes on as its values all the
  7445.       directories in a branch of a directory tree including the entire tree of
  7446.       a disk or disks.
  7447.             Manual reference: Section VI.10
  7448.             Examples: FORDIR $1 IN () DO BEGIN [] ++$2 [] ECHOLN $2:$1 [] END
  7449.             See also: FOR, WHILE, UNTIL, DO, IN, TO
  7450.       ----------------------------------------------------------------------
  7451.       FPretty         {}          Input: CM, FI       Output: DI
  7452.             Parameters: filename and optional label
  7453.             {FP filename label} finds the file "filename" and searches
  7454.       for a line ":label".  It then echoes each line between that label
  7455.       and the next line starting with ":".  The initial attributes are
  7456.       determined by AT and MN but they can by changed by using @ followed
  7457.       immediately by a hex attribute. Full metastring translation takes
  7458.       place.  A CR/LF is echoed for each line in the file except for the
  7459.       last. Attributes reset to AT/MN for each new line.
  7460.             Manual reference: Sections III.6, I.5
  7461.             Examples: batutil {FP %0 foo}
  7462.             Internal parameters: AT, MN, %0
  7463.             See also: ECho, FEcho, FPretty, ATttribute, MNattribute
  7464.       ----------------------------------------------------------------------
  7465.  
  7466.  
  7467.       Chapter VIII:COMMAND REFERENCE                            Page 138
  7468.  
  7469.  
  7470.  
  7471.  
  7472.                         Documentation for BATUTIL, Version 4.0
  7473.  
  7474.  
  7475.       GEtkey          []/{}       Input: CM, US       Output: EL
  7476.             Parameters: List of keys as found in Section IV.4.  First
  7477.       parameter may be WAnnn or WAEnnn and final one may be BEep or ELse
  7478.             GEtkey waits for a keystroke from the user from a list supplied
  7479.       with the command and returns the number of the choice in the
  7480.       errorlevel.  The choice is echoed on the screen.  If the final "key" is
  7481.       BEep, the user is beeped for incorrect choices; if it is ELse, an
  7482.       incorrect choice causes an exit.  WAit and WAit with Echo will exit
  7483.       after a period with errorlevel set to 0
  7484.             Values: 0 to 64
  7485.             Manual reference: Sections IV.4, IV.5
  7486.             Examples: batutil {GE Y N}
  7487.             Internal parameters: NFlush, CSent, VIsual
  7488.             See also: MEnu, NFlush, CSent, VIsual
  7489.       ----------------------------------------------------------------------
  7490.       GOto            BUSIC command
  7491.             Parameters: labelname
  7492.             Transfer program control to the line following the label with the
  7493.       specified labelname.  If the labelname is not found, the label ELSE is
  7494.       searched for.  HALTxxx and EXITxxx have special meanings.  Labelnames
  7495.       have metastring translation done.
  7496.             Manual reference: Section VI.7
  7497.             Examples: GO foo1 [] LA foo [] --$1 [] ECho $1$_ [] RET
  7498.                           LA foo1 [] FOR $2=1 TO 7 CALL foo
  7499.             See also: LAbel, CALL
  7500.       ----------------------------------------------------------------------
  7501.       HACKER           {}         Input: CM          Output: IN
  7502.             {HACKER +} will turn on 'hacker mode' in which you can read and
  7503.       write directly to memory or to ports (equivalent to BASIC's peeks,
  7504.       pokes, in and outs).  This mode should only be turned on if you know
  7505.       what you are doing when you write to your hardware!  This command does
  7506.       NOT have a minimal truncation.
  7507.             Manual reference: Section VI.13
  7508.             Examples: batutil {HACKER +}{SEt $Z(0:417)=0}
  7509.             See also: $Z, $z
  7510.       ----------------------------------------------------------------------
  7511.       HImem           []/{}       Input: None         Output: EL
  7512.             Parameters: None
  7513.             Returns 0 if no XMS (Himem) driver is loaded and 1 if one is
  7514.       loaded
  7515.             Values: 0 or 1
  7516.             Manual reference: Section II.3
  7517.             Examples: batutil [HI]
  7518.       ----------------------------------------------------------------------
  7519.  
  7520.  
  7521.       Chapter VIII:COMMAND REFERENCE                            Page 139
  7522.  
  7523.  
  7524.  
  7525.  
  7526.                         Documentation for BATUTIL, Version 4.0
  7527.  
  7528.  
  7529.       HOur            []/{}       Input: None         Output: EL
  7530.             Parameters: None
  7531.             Returns the hour of the day in military time from 0 to 23
  7532.             Values: 0 to 23
  7533.             Manual reference: Section II.2
  7534.             Examples: batutil [HO]
  7535.             See also: DAte, MInute, WEekday, MOnth, YEar
  7536.       ----------------------------------------------------------------------
  7537.       IF                BUSIC command
  7538.             Fundemental branching command with if...then and if...then...else
  7539.       variants.  The comparison after if can be equality of strings or
  7540.       numeric comparison (=, > or <).  AND and OR are not supported in this
  7541.       version but AND can be simulated with nest IFs and ORs with multiple
  7542.       IF's.  A not in the form ~(...) is supported for comparisons.  The then
  7543.       and optional else clauses can be a single command or multiple commands
  7544.       within a  BEGIN/END pair.
  7545.             Manual reference: Section VI.8
  7546.             Examples: IF $1=3 THEN GOto case3 ELSE CALL case2
  7547.             See also: THEN, ELSE, BEGIN, END, CASE
  7548.       ----------------------------------------------------------------------
  7549.       IN                BUSIC keyword
  7550.             Keyword required with FOR loops that are of list form.
  7551.             Manual reference: Section VI.10
  7552.             Examples: FOR $1 IN (*.EXE *.COM) DO ECHOLN $1
  7553.             See also: FOR, FORDIR, WHILE, UNTIL, DO, TO
  7554.       ----------------------------------------------------------------------
  7555.       INclude         {}          Input: CM, FI       Output: IN
  7556.             Parameters: filename and optional label
  7557.             INclude is a synonym for FCommand
  7558.             See also: FCommand
  7559.       ----------------------------------------------------------------------
  7560.       IOerror       {}          Input: CM           Output: IN
  7561.             Parameters: + or -
  7562.             By default, any file error will stop BATUTIL with a fatal error,
  7563.       usually 233 or 245.  {IO -} will prevent the fatal error and instead
  7564.       place an error code into the variable $%.  {IO +} will turn file error
  7565.       halting back on.  This only affects $R(...) and >> file IO errors.
  7566.             Manual reference: Section VI.5
  7567.             Examples: IO - [] $R(foobar.txt) [] IF $% > 0 THEN GOto fileerror
  7568.             See also: >, >>, $R, $R(...), $%
  7569.       ----------------------------------------------------------------------
  7570.  
  7571.  
  7572.  
  7573.  
  7574.  
  7575.       Chapter VIII:COMMAND REFERENCE                            Page 140
  7576.  
  7577.  
  7578.  
  7579.  
  7580.                         Documentation for BATUTIL, Version 4.0
  7581.  
  7582.  
  7583.       ISnum            []         Input: CM           Output:EL
  7584.             Parameters: string
  7585.                        string min max
  7586.             Determines if a string is a number in the range [min,max].
  7587.       Possible returned values are
  7588.             0 = the string is number between min and max (inclusive)
  7589.             1 = the string is a number greater than max
  7590.             2 = the string is a number less than min
  7591.             3 = it is not a number
  7592.             Manual reference: Section VI.3
  7593.             Examples: batutil {LA start}{$1=$Q}{IS $1}{IF $r >0 GO start}
  7594.             See also: ++, --, $1=, $N
  7595.       ----------------------------------------------------------------------
  7596.       KIllenv         {}          Input: CM           Output: EN
  7597.             Parameters: List of environment variables
  7598.             Removes all strings from the environment except for COMSPEC and
  7599.       any variables explicitly listed after {KI}
  7600.             Manual reference: Section V.7
  7601.             Examples: batutil {SA present.env}{KI path}
  7602.             See also: SAvenv, LOadenv
  7603.       ----------------------------------------------------------------------
  7604.       LAbel             BUSIC command
  7605.             Parameters: labelname
  7606.             The command
  7607.                 LA name
  7608.       sets up a label as a target for CALL and GOto.  The label ELse has
  7609.       special significance.
  7610.             Manual reference: Section VI.7
  7611.             Examples: GO foo1 [] LA foo [] --$1 [] ECho $1$_ [] RET
  7612.                           LA foo1 [] FOR $2=1 TO 7 CALL foo
  7613.             See also: GOto, CALL
  7614.       ----------------------------------------------------------------------
  7615.       LEngth          []/{}       Input: CM           Output: EL
  7616.             Parameters: string with metastring translation
  7617.             Returns the length of the string given so {LE $x(foo)} would
  7618.       return the length of the environmental variable foo.
  7619.             Values: 0 to 199
  7620.             Manual reference: Section V.5
  7621.             Examples: batutil [LE $x(name)]
  7622.       ----------------------------------------------------------------------
  7623.  
  7624.  
  7625.  
  7626.  
  7627.  
  7628.  
  7629.       Chapter VIII:COMMAND REFERENCE                            Page 141
  7630.  
  7631.  
  7632.  
  7633.  
  7634.                         Documentation for BATUTIL, Version 4.0
  7635.  
  7636.  
  7637.       LIm             []/{}       Input: None         Output: EL
  7638.             Parameters: None
  7639.             Returns 0 if no EMS driver is found and otherwise 10 times the
  7640.       LIM Version.
  7641.             Values: Various - most common are 0, 32, 40
  7642.             Manual reference: Section II.3
  7643.             Examples: batutil [LI]
  7644.       ----------------------------------------------------------------------
  7645.       LOadenv         {}          Input: CM           Output: EN
  7646.             Parameters: Filename or Filename /m
  7647.             Finds the file given (looks on path if need be) and if found
  7648.       either replaces the environment with the content of the file or if the
  7649.       /m parameter is included merges it with the environment.  No action
  7650.       taken if the file is not appropriate (ASCII with an equal sign on each
  7651.       line and all caps prior to the equal sign).
  7652.             Manual reference: Section V.7
  7653.             Examples: batutil {LO present.env}
  7654.             See also: KIllenv, SAvenv
  7655.       ----------------------------------------------------------------------
  7656.       MAke            []/{}       Input: CM, SY       Output: EL
  7657.             Parameters: A pair of filenames
  7658.             Intended for a homebrewed UNIX type MAKE utility this takes two
  7659.       filenames and returns codes as follows:
  7660.             0 = file2 not found
  7661.             1 = file2 is strictly older
  7662.             2 = file1 not found
  7663.             3 = file1 older or the same age as file2
  7664.             9 = path not found
  7665.             Values: 0,1,2,3,9
  7666.             Manual reference: Section II.8
  7667.             Examples: batutil [MA foobar.pas foobar.exe]
  7668.             See also: EXist, TOdayfile
  7669.       ----------------------------------------------------------------------
  7670.       MEnu            []/{}       Input: CM, BU, US   Output: EL
  7671.             Parameters: List of choices separated by spaces
  7672.             Makes a menu with choices given by the list of parameters
  7673.       following the ME command.  The number of the user's choice is returned
  7674.       in the errorlevel.  Capital letters used for speed choices.
  7675.             Manual reference: Sections IV.1, IV.3
  7676.             Examples: batutil [ME Copy Erase Rename eXit]
  7677.             Internal parameters: NMouse, MHeader, POp, SHadow, FKey
  7678.             See also: FMenu, NMouse, MHeader, POp, SHadow, FKey
  7679.       ----------------------------------------------------------------------
  7680.  
  7681.  
  7682.  
  7683.       Chapter VIII:COMMAND REFERENCE                            Page 142
  7684.  
  7685.  
  7686.  
  7687.  
  7688.                         Documentation for BATUTIL, Version 4.0
  7689.  
  7690.  
  7691.       MHeader         {}          Input: CM           Output: IN
  7692.             Parameters: String
  7693.             Allows you to specify a header to appear at top of a menu
  7694.       prepared with a subsequent MEnu or FMenu command (on the same BATUTIL
  7695.       command line ).  Metastring translation is done.
  7696.             Manual reference: Section IV.3
  7697.             Examples: batutil {MH My menu: $E}[ME Copy Erase Rename eXit]
  7698.             See also: FMenu, MEnu
  7699.       ----------------------------------------------------------------------
  7700.       MInute          []/{}       Input: None         Output: EL
  7701.             Parameters: None
  7702.             Returns the minute of the hour from 0 to 59
  7703.             Values: 0 to 59
  7704.             Manual reference: Section II.2
  7705.             Examples: batutil [MI]
  7706.             See also: DAte, HOur, WEekday, MOnth, YEar
  7707.       ----------------------------------------------------------------------
  7708.       MNattribute     {}          Input: CM           Output: IN
  7709.             Parameters: Hex number from 0 to FF with optional leading $
  7710.             BATUTIL keeps an internal attribute used when EChoing, for
  7711.       shadows in MEnus, when the CLs command clears the screen,for the $?
  7712.       command.  Separate attributes are keep for graphics and monochrome
  7713.       screens. It defaults to $07 (normal).  The {MN xx} changes it.  See
  7714.       Section III.3 for a list of attributes. Two special values do not have
  7715.       their default meaning: $55 uses the attribute at the cursor at the time
  7716.       that ECho is called; $66 write with no change in the underlying
  7717.       attributes.
  7718.             Manual reference: Section III.3
  7719.             Examples: batutil {EC hello$S}{MN $70}{EC there}   would echo
  7720.       "hello " in normal and "there" in reverse video
  7721.             See also: ATtribute, ECho, PRetty, CLs, EOline
  7722.       ----------------------------------------------------------------------
  7723.       MOnth           []/{}       Input: None         Output: EL
  7724.             Parameters: None
  7725.             Returns the month of the year from 1 to 12
  7726.             Values: 1 to 12
  7727.             Manual reference: Section II.2
  7728.             Examples: batutil [MO]
  7729.             See also: DAte, HOur, WEekday, MInute, YEar
  7730.       ----------------------------------------------------------------------
  7731.  
  7732.  
  7733.  
  7734.  
  7735.  
  7736.  
  7737.       Chapter VIII:COMMAND REFERENCE                            Page 143
  7738.  
  7739.  
  7740.  
  7741.  
  7742.                         Documentation for BATUTIL, Version 4.0
  7743.  
  7744.  
  7745.       NBeep           {}          Input: None         Output: IN
  7746.             Parameters: None
  7747.             Suppresses beeps in the EDitenv and PAthedit commands
  7748.             Manual reference: Section V.9
  7749.             Examples: batutil {NB}{ED}
  7750.             See also: EDitenv, PAthedit
  7751.       ----------------------------------------------------------------------
  7752.       NFlush          {}          Input: None         Output: IN
  7753.             Parameters: None
  7754.             The keyboard is flushed before user input is gotten for the
  7755.       GEtkey and USername commands; NFlush will tell the next call to either
  7756.       of these to not flush the keyboard allowing STACKEY input or prior user
  7757.       input.  The internal flag is reset by such a call.
  7758.             Manual reference: Section IV.5
  7759.             Examples: batutil {NF}{GE Y N}{GE Y N}  ; the first call
  7760.       would not flush the buffer; the second would.
  7761.             See also: GEtkey, USername
  7762.       ----------------------------------------------------------------------
  7763.       NMouse          {}          Input: None         Output: IN
  7764.             Parameters: None
  7765.             MEnu and FMenu allow the use of a Microsoft compatible mouse
  7766.       if present.  NMouse will suppress the use of a mouse. The internal
  7767.       flag is reset by such a call.
  7768.             Manual reference: Section IV.1
  7769.             Examples: batutil {NM}[ME Copy Erase Rename eXit]
  7770.             See also: MEnu, FMenu
  7771.       ----------------------------------------------------------------------
  7772.       NSound          {}          Input: None         Output: IN
  7773.             Parameters: None
  7774.             The sound command will be suppressed if this parameter is
  7775.       set.  Only makes sense if used as part of an BU@ environment
  7776.       string.
  7777.             Manual reference: Section III.10
  7778.             Examples: set BU@={NS}
  7779.             See also: SOund
  7780.       ----------------------------------------------------------------------
  7781.       NUmberfiles     []/{}       Input: CM, SY       Output: EL
  7782.             Parameters: filespec(s) with path and wildcards allowed.
  7783.             Returns the total number of files found matching one of the given
  7784.       filespecs up to 199
  7785.             Values: 0 to 199
  7786.             Manual reference: Section II.6
  7787.             Examples: batutil {NU C:\bin\*.com C:\bin\*.exe}
  7788.             See also: EXist, CHeck
  7789.  
  7790.  
  7791.       Chapter VIII:COMMAND REFERENCE                            Page 144
  7792.  
  7793.  
  7794.  
  7795.  
  7796.                         Documentation for BATUTIL, Version 4.0
  7797.  
  7798.  
  7799.       ----------------------------------------------------------------------
  7800.       OF                BUSIC keyword
  7801.             Keyword required in CASE statement.
  7802.             Manual reference: Section VI.8
  7803.             Examples: CASE $1 OF [] 1:$2=EGA [] 2:$2=VGA [] ENDCASE
  7804.             See also: IF, ENDCASE
  7805.       ----------------------------------------------------------------------
  7806.       P  Pause mode      Initial Parameter            Output:  IN
  7807.             Parameters: None
  7808.             If the first parameter on the command line or in BU@ is P (or
  7809.       p), then Pause mode is turned on and messages are displayed when
  7810.       BATUTIL exits with an error and processing is halted until you hit
  7811.       a key.
  7812.             Manual reference: Section I.3
  7813.             Examples: batutil P {EC $A}
  7814.       ----------------------------------------------------------------------
  7815.       PAthedit        {}          Input: SY, US       Output: EN
  7816.             Parameters: None
  7817.             Calls up an interactive editor to edit the path
  7818.             Manual reference: Section V.9
  7819.             Examples: batutil {PA}
  7820.             Internal parameters: NBeep
  7821.             See also: EDitenv, NBeep, ADdpath, DElpath
  7822.       ----------------------------------------------------------------------
  7823.       PMatch          []/{}       Input: CM           Output: EL
  7824.             Parameters: List of words
  7825.             If the words are labelled word0, word1, ... , this command will
  7826.       try to match word0 to word1,....  If there is no match the
  7827.       errorlevel is set to 0; otherwise to number of the first match
  7828.       found.  Intended to check batch file parameters.  By default not
  7829.       case sensitive.
  7830.             Values: 0 to 64
  7831.             Manual reference: Section IV.8
  7832.             Examples: batutil {PM %1 bold compressed underline}
  7833.             Internal parameters: CSent
  7834.             See also: CSent
  7835.       ----------------------------------------------------------------------
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.       Chapter VIII:COMMAND REFERENCE                            Page 145
  7846.  
  7847.  
  7848.  
  7849.  
  7850.                         Documentation for BATUTIL, Version 4.0
  7851.  
  7852.  
  7853.       POp             {}          Input: CM           Output: IN
  7854.             Parameters: None or +
  7855.             By default, menus just appear on the screen.  {PO} will cause
  7856.       them to appear with a visual explosion and {PO +} with a visual
  7857.       explosion and a popping sound.  The visual/sound effects occur also
  7858.       when the menu pops down.  The internal flag is reset by such a call.
  7859.             Manual reference: Section IV.3
  7860.             Examples: batutil {PO +}[FM %0 menulist]
  7861.             See also: MEnu, FMenu
  7862.       ----------------------------------------------------------------------
  7863.       PRetty          {}          Input: CM           Output: DI
  7864.             Parameters: String to display with embedded @ commands
  7865.             Like ECho, this will display a string but with a change in
  7866.       attribute possible in mid-string by inserting @ followed by the hex
  7867.       attribute number
  7868.             Manual reference: Section III.5
  7869.             Examples: batutil {PR @1FH@1Ei}
  7870.             Internal parameters: AT, MN
  7871.             See also: ECho, FEcho, FPretty, ATttribute, MNattribute
  7872.       ----------------------------------------------------------------------
  7873.       PUt            {}           Input: CM           Output: EN
  7874.             Parameters: + or -
  7875.             The command {PUt +} places all the non-empty internal variables
  7876.       saved by BATUTIL and places them into the DOS environment as strings
  7877.       with values $1, etc.  {PUt -} looks at the environment and finds any
  7878.       variables of the form $1,...,$0,$é,...,$ò and moves them to internal
  7879.       variables, removing them from the environment at the same time.  These
  7880.       commands are intended to allow saving of values from one running of
  7881.       BATUTIL until another.
  7882.             Manual reference: Section VI.1
  7883.             Examples: batutil {$1=0}{FORDIR $2 IN () DO ++ $1}{PU +}
  7884.       ----------------------------------------------------------------------
  7885.       Q  Quiet mode      Initial Parameter            Output:  IN
  7886.             Parameters: None
  7887.             If the first parameter on the command line or in BU@ is Q (or q),
  7888.       then Quiet mode is turned on and no messages are displayed when BATUTIL
  7889.       exits with an fatal error.
  7890.             Manual reference: Section I.3
  7891.             Examples: batutil Q {EC $A}
  7892.       ----------------------------------------------------------------------
  7893.  
  7894.  
  7895.  
  7896.  
  7897.  
  7898.  
  7899.       Chapter VIII:COMMAND REFERENCE                            Page 146
  7900.  
  7901.  
  7902.  
  7903.  
  7904.                         Documentation for BATUTIL, Version 4.0
  7905.  
  7906.  
  7907.       QLock           []/{}       Input: CM, SY       Output: EL, SY
  7908.             Parameters: First parameter one of C,N,S,I; second optional +/-
  7909.             Returns errorlevel based on the states of one of CapsLock,
  7910.       Numlock, ScrollLock, Insert mode.  Optional turns off (-) or on (+)
  7911.             Values: 0 = off, 1 = on
  7912.             Manual reference: Section IV.9
  7913.             Examples: batutil [C -] will test Capslock and turn it off
  7914.       ----------------------------------------------------------------------
  7915.       QUery           {}          Input: CM           Output: IN
  7916.             Parameters: - or +
  7917.             {QU -} sets an internal flag turning off translation of $Q and $?
  7918.       metastrings in the set command.  {QU +} undoes the effect of {QU -}.
  7919.       BATUTIL does not keep internal flags from one running to the next so
  7920.       $Q, $? translation is turned back on for each new loading.
  7921.             Manual reference: Section V.5
  7922.             Examples: batutil {QU-}{SEt foo1=$Q}{QU +}{SEt foo2=$Q}
  7923.               would set foo1 to $Q and foo2 to a user entered string.
  7924.             See also: $Translates, ^Translate, $Q/$?
  7925.       ----------------------------------------------------------------------
  7926.       RC              {}          Input: CM          Output: IN
  7927.             Parameters: $ or nothing
  7928.             {RC $} tells BATUTIL to stop using the environmental variable RC
  7929.       and instead store what would have been put into RC instead as an
  7930.       internal variable $r.  {RC} resets this to return to the use of RC and
  7931.       to having calls to $r be equivalent to $x(rc).
  7932.             Manual reference: Section VI.1
  7933.             Examples: batutil {RC $}{DOs W}{EC $r}
  7934.       ----------------------------------------------------------------------
  7935.       REm             {}          Input: None         Output: None
  7936.             Parameters: None
  7937.             Allows placing of remarks in a BATUTIL command line
  7938.             Manual reference: Section I.5
  7939.             Examples: batutil {AT $4E}{CL}{RE clears screen in red!}
  7940.       ----------------------------------------------------------------------
  7941.       REPEAT                    BUSIC command
  7942.             BUSIC command to cycle through a set of commands at least once
  7943.       checking at the end of a cycle to see if a condition holds.  If the
  7944.       condition holds then stop the cycle; otherwise repeat it.
  7945.             Manual reference: Section VI.9
  7946.             Examples: REPEAT [] ECHOLN $1 [] ++ $1 [] UNTIL $1 > 7
  7947.             See also: UNTIL, WHILE
  7948.       ----------------------------------------------------------------------
  7949.  
  7950.  
  7951.  
  7952.  
  7953.       Chapter VIII:COMMAND REFERENCE                            Page 147
  7954.  
  7955.  
  7956.  
  7957.  
  7958.                         Documentation for BATUTIL, Version 4.0
  7959.  
  7960.  
  7961.       RET               BUSIC keyword
  7962.             Parameters: None
  7963.             Matching keyword required at the end of subroutine.  It must have
  7964.       a matching LAbel.  You need to jump over subroutines because a RET
  7965.       reached not as part of a CALL is an error.
  7966.             Manual reference: Section VI.7
  7967.             Examples: GO foo1 [] LA foo [] --$1 [] ECho $1$_ [] RET
  7968.                           LA foo1 [] FOR $2=1 TO 7 CALL foo
  7969.             See also: GOto, LAbel, CALL
  7970.       ----------------------------------------------------------------------
  7971.       ROw             {}          Input: CM           Output: DI
  7972.             Parameters: One decimal number with optional +, - or T in front;
  7973.       decimal number must be between 1 and 25.
  7974.             Moves the cursor; if just a number is given the cursor is moved
  7975.       to precisely that row.  If a plus or minus precedes the number,
  7976.       then the movement is relative to the current position but wrapping
  7977.       does not take place at the screen top.  Scrolling will take place
  7978.       at the screen bottom.  {RO Txx} sets the location of where the
  7979.       countdown clock will occur with {GEtkey WAit}.
  7980.             Manual reference: Sections III.8, IV.5
  7981.             Examples: batutil {CL}{RO 5}{EC This line is line 5}
  7982.                       batutil {RO 1}{EC Time Left:}{RO T1}{CO T12}{GE WA60}
  7983.             See also: COl, CUrsor
  7984.       ----------------------------------------------------------------------
  7985.       RUn             []/{}       Input: CM           Output: EL, EX
  7986.             Parameters: Program name and parameters
  7987.             This will search the path for the program in question, run it and
  7988.       return the errorlevel.  Only runs com and exe files but you can use
  7989.       command.com with the C parameter to run batch files or internal
  7990.       commands.  By default, BATUTIL will swap most of itself to EMS or disk.
  7991.             Values: 0 to 255
  7992.             Manual reference: Section II.7
  7993.             Examples: batutil [RU programname]
  7994.       ----------------------------------------------------------------------
  7995.       SAvenv          {}          Input: CM           Output: EN
  7996.             Parameters: Filename
  7997.             Saves the current environment to an ASCII file in the form
  7998.               VARNANE=var_value
  7999.       one variable per line.  Errorlevel set to 199 if the filename
  8000.       exists and user doesn't allow the file to be overwritten
  8001.             Manual reference: Section V.7
  8002.             Examples: batutil {SA present.env}
  8003.             See also: KIllenv, LOadenv
  8004.       ----------------------------------------------------------------------
  8005.  
  8006.  
  8007.       Chapter VIII:COMMAND REFERENCE                            Page 148
  8008.  
  8009.  
  8010.  
  8011.  
  8012.                         Documentation for BATUTIL, Version 4.0
  8013.  
  8014.  
  8015.       SCanread        []/{}       Input: US           Output: EL
  8016.             Parameters: None
  8017.  
  8018.             Waits for a keystroke and reports the "Scancode" part of the
  8019.       int 16H value for the keystruck
  8020.             Values: 0 to 199
  8021.             Manual reference: Section IV.6
  8022.             Examples: batutil [SC]
  8023.             Internal parameters: NFlush (determines whether the keyboard is
  8024.       flushed)
  8025.             See also: ASciiread, GEtkey, NFlush
  8026.       ----------------------------------------------------------------------
  8027.       SEt             {}          Input: CM           Output: EN
  8028.             Parameters: One or more of the form varname=varvalue
  8029.             SE allows you to place variables in the active DOS environment.
  8030.       Metastring translation takes place including $x, $f, $Q/$?/$N.
  8031.             Manual reference: Sections V.3, V.4, V.5
  8032.             Examples: batutil {ec Enter filespec}{set ab=$Q file=$f($x(ab))}
  8033.             Internal parameters: $Translate, ^Translate, QUery
  8034.             See also: $f, $x, $Q/$?, $Translate, ^Translate, QUery
  8035.       ----------------------------------------------------------------------
  8036.       SHadow          {}          Input: None         Output: IN
  8037.             Parameters: None
  8038.             By default, menus just appear on the screen.  {SH} will cause
  8039.       them to appear with shadow in the current colors as set by AT/MN.
  8040.       The internal flag is reset by such a call.
  8041.             Manual reference: Section IV.3
  8042.             Examples: batutil {SH}[FM %0 menulist]
  8043.             Internal parameters: AT, MN
  8044.             See also: MEnu, FMenu
  8045.       ----------------------------------------------------------------------
  8046.       SKey            {}          Input: CM           Output: EX
  8047.             Parameters: Stackey command string (with limitations)
  8048.             So long as Stackey is loaded before BATUTIL, the SKey command will
  8049.       place keystrokes in the Stackey buffer without the need to RUn stackey.
  8050.       Most but not all Stackey commands are allowed and metastring translation
  8051.       takes place.
  8052.             Manual reference: Section II.7
  8053.             Examples: batutil {SK F1 "hi there" $E ^T}
  8054.             See also: RUn
  8055.       ----------------------------------------------------------------------
  8056.  
  8057.  
  8058.  
  8059.  
  8060.  
  8061.       Chapter VIII:COMMAND REFERENCE                            Page 149
  8062.  
  8063.  
  8064.  
  8065.  
  8066.                         Documentation for BATUTIL, Version 4.0
  8067.  
  8068.  
  8069.       SOund           {}          Input: CM           Output: DI
  8070.             Parameters: Sound number from 1 to 20; optional repeat count
  8071.             Makes one of 20 sounds; 1 to 10 are small sounds, 11 to 20 are
  8072.       tunes
  8073.             Manual reference: Section III.10
  8074.             Examples: batutil {SO 18}
  8075.             Internal parameters: NSound
  8076.             See also: NSound
  8077.       ----------------------------------------------------------------------
  8078.       STdout          {}          Input: CM           Output: IN
  8079.             Parameters: - or optional +
  8080.             {ST +} (equivalent to {ST}) will direct output from the BATUTIL
  8081.       {ECho} command to standard output which can redirected.  {ST -} will
  8082.       return to the default behavior of writing ECho output directly to
  8083.       the screen in colors set with AT/MN.
  8084.             Manual reference: Section III.9
  8085.             Examples: batutil {ST}{EC ^G}{ST -}{EC You dummy!!!}
  8086.             See also: ECho
  8087.       ----------------------------------------------------------------------
  8088.       THEN              BUSIC keyword
  8089.             Keyword used as part of IF...THEN and IF...THEN...ELSE
  8090.       constructions
  8091.             Manual reference: Section VI.8
  8092.             Examples: IF $1=3 THEN GOto case3 ELSE CALL case2
  8093.             See also: IF, ELSE, BEGIN, END, CASE
  8094.       ----------------------------------------------------------------------
  8095.       TO                BUSIC keyword
  8096.             Keyword used as part of a incremental FOR loop
  8097.             Manual reference: Section VI.9
  8098.             Examples: FOR $1=1 T0 8 ECHOLN $1
  8099.             See also: FOR, WHILE, UNTIL, DO, IN
  8100.       ----------------------------------------------------------------------
  8101.  
  8102.  
  8103.  
  8104.  
  8105.  
  8106.  
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.  
  8113.  
  8114.  
  8115.       Chapter VIII:COMMAND REFERENCE                            Page 150
  8116.  
  8117.  
  8118.  
  8119.  
  8120.                         Documentation for BATUTIL, Version 4.0
  8121.  
  8122.  
  8123.       TOdayfile       []/{}       Input: CM, SY       Output: EL
  8124.             Parameters: Filename without wildcards; optional hour
  8125.             {TO filename} will search for the file specified and check its
  8126.       date against today's date and return the following:
  8127.             0 = the file has today's date
  8128.             1 = the file exists and doesn't have today's date
  8129.             2 = file not found           9 = invalid path
  8130.       If two parameters are given, the first must be a number from 0 to
  8131.       23. Then, "today" and the file date/time will be compared assuming
  8132.       days start at the hour in the first parameter.
  8133.             Values: 0,1,2,9
  8134.             Manual reference: Section II.8
  8135.             Examples: batutil {TO test.txt}
  8136.                       batutil {TO 5 test.txt}
  8137.             See also: EXist, MAke
  8138.       ----------------------------------------------------------------------
  8139.       TRace     {}              IN: CM, BU, US          OUT: DI, IN, EX
  8140.             Parameters: Ffilename, Wvarname, W-, ON, OFF, *, %, nnn, $nn,
  8141.                           Xnnn,X$nn
  8142.             {TR on} will turn on BATUTIL's interactive debugger.  There are
  8143.       many other options including output to a file, watch variables and more.
  8144.       See the detailed discussion in the manual.
  8145.             Manual reference: Section VI.12
  8146.             Examples: batutil {TR ON}
  8147.       ----------------------------------------------------------------------
  8148.       UNTIL             BUSIC keyword
  8149.             Keyword that matches REPEAT and indicates the end of a repeat
  8150.       cycle.  The condition that is checked at the end of the cycle appears on
  8151.       the UNTIL line.
  8152.             Manual reference: Section VI.9
  8153.             Examples: REPEAT [] ECHOLN $1 [] ++ $1 [] UNTIL $1 > 7
  8154.             See also: REPEAT, WHILE
  8155.       ----------------------------------------------------------------------
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.       Chapter VIII:COMMAND REFERENCE                            Page 151
  8170.  
  8171.  
  8172.  
  8173.  
  8174.                         Documentation for BATUTIL, Version 4.0
  8175.  
  8176.  
  8177.       USername        []/{}       Input: CM, US       Output: EL
  8178.             Parameters: sequence of names; first one can be a number of
  8179.               tries; second can be *
  8180.             In its simplest form, a sequence of words are given following
  8181.       {US.  The user types in a "username" and BATUTIL responds which number
  8182.       in the list was matched and 0 if the string did not match.  If a number
  8183.       is given as the first parameter, the user will have additional chances
  8184.       and the remaining parameters are labeled 1,2,.. and the same rules
  8185.       apply.  If the second parameter is *, the same rules apply (with the
  8186.       third parameter now as choice 1) BUT the system is halted if no correct
  8187.       choice is given.
  8188.             Values: 0 to 64
  8189.             Manual reference: Section IV.7
  8190.             Examples: batutil [US george mary scott]
  8191.             Internal parameters: CSent
  8192.             See also: CSent
  8193.       ----------------------------------------------------------------------
  8194.       V  Verbose mode    Initial Parameter            Output:  IN
  8195.             Parameters: None
  8196.             If the first parameter on the command line or in BU@ is V (or v),
  8197.       then Verbose mode is turned on and messages are displayed when BATUTIL
  8198.       exits with an error.
  8199.             Manual reference: Section I.3
  8200.             Examples: batutil V {EC $A}
  8201.       ----------------------------------------------------------------------
  8202.       VIsual          {}          Input: CM           Output: IN
  8203.             Parameters:  A,1,N,D,DA,D1,DN
  8204.             Determines the degree of visual feedback from the GEtkey command.
  8205.       The default is to have matching choices echoed including #nnn and two
  8206.       letter abbreviations.  A will have incorrect choices echoed in the form
  8207.       letter? or ¿? for keys without ASCII codes.  1 will restrict echoes only
  8208.       to single ASCII codes and N will suppress echos.  By default, the cursor
  8209.       moves on space after a GEtkey - D suppresses that space.
  8210.             Manual reference: Section IV.5
  8211.             Examples: batutil {VI DA}{EC Choose a key}{GE Y N}
  8212.             See also: GEtkey
  8213.       ----------------------------------------------------------------------
  8214.       WEekday         []/{}       Input: None         Output: EL
  8215.             Parameters: None
  8216.             Returns the day of the week from 0 = Sunday to 6 = Saturday
  8217.             Values: 0 to 6
  8218.             Manual reference: Section II.2
  8219.             Examples: batutil [WE]
  8220.             See also: DAte, HOur, MOnth, MInute, YEar
  8221.  
  8222.  
  8223.       Chapter VIII:COMMAND REFERENCE                            Page 152
  8224.  
  8225.  
  8226.  
  8227.  
  8228.                         Documentation for BATUTIL, Version 4.0
  8229.  
  8230.  
  8231.       ----------------------------------------------------------------------
  8232.       WHILE             BUSIC command
  8233.             A BUSIC loop command.  A condition is checked before the loop
  8234.       begins and if it fails the loop is terminated.  Multiple commands allow
  8235.       with a BEGIN...END pair.
  8236.             Manual reference: Section VI.9
  8237.             Examples: WHILE $1 < 8 DO BEGIN [] ECHOLN $1 [] ++ $1 [] END
  8238.             See also: DO, UNTIL
  8239.       ----------------------------------------------------------------------
  8240.       Year            []/{}       Input: None         Output: EL
  8241.             Parameters: None
  8242.             Returns the year since 1980 (i.e. 0 = 1980, 10 = 1990)
  8243.             Values: 0 to 19
  8244.             Manual reference: Section II.2
  8245.             Examples: batutil [YE]
  8246.             See also: DAte, HOur, WEekday, MInute, MOnth
  8247.       ----------------------------------------------------------------------
  8248.  
  8249.  
  8250.  
  8251.  
  8252.  
  8253.  
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259.  
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.  
  8266.  
  8267.  
  8268.  
  8269.  
  8270.  
  8271.  
  8272.  
  8273.  
  8274.  
  8275.  
  8276.  
  8277.       Chapter VIII:COMMAND REFERENCE                            Page 153
  8278.  
  8279.  
  8280.  
  8281.  
  8282.                           Chapter IX:ERROR MESSAGES
  8283.  
  8284.       IX.1 Fatal Errors
  8285.  
  8286.             There are certain errors that you may make in syntax or
  8287.       problems with your trying to place something in the environment for
  8288.       which there isn't room from which BATUTIL cannot recover or where it
  8289.       cannot figure out the action you'd want it to take.  There may also
  8290.       be situations where what we think is the environment doesn't seem
  8291.       right and BATUTIL would then want you to contact us and inform us of
  8292.       what has happened.  In all these situations BATUTIL exits.  One
  8293.       action it does to indicate such a fatal error is to exit with the DOS
  8294.       errorlevel set to a number between 200 and 253.  Only the AScii
  8295.       command and the RUn command can return errorlevels in this range
  8296.       without indicating an error.  Errorlevel 254 is reserved for the
  8297.       HAltif command and errorlevel 255 for ^Break exits.  All other
  8298.       commands set an errorlevel in the range 0 to 199.
  8299.  
  8300.             BATUTIL was incompatible with early versions of DR DOS 5.0 and
  8301.       with later versions of the same product if run from a shell and would
  8302.       give fatal error messages.  This problem persists with DR DOS 6.0.
  8303.       It's because of a lack of DOS compatibility.  It will run if 4DOS is
  8304.       used over DRDOS rather than DRDOS' command.com.
  8305.  
  8306.             While debugging a BATUTIL script, you can use either VERBOSE or
  8307.       PAUSE mode.  The verbose mode is the default and can be turned off by
  8308.       using a Q (not in brackets) as the first non blank character on the
  8309.       BATUTIL command line or in the BU@ environmental variable.  Pause mode
  8310.       can be turned on similarly except that P is used in place of V.  See
  8311.       Section I.3 for further discussion.
  8312.  
  8313.             Normally, file errors are fatal but you can modify this
  8314.       behavior for $R errors with the IO command, see Section VI.5.
  8315.  
  8316.  
  8317.       IX.2 List of Error Codes
  8318.  
  8319.       200: Not a BATUTIL command
  8320.       201: Does not effect errorlevel; use {} not [ ]
  8321.       202: Incorrect placement of [,],{ or }
  8322.       204: Some of the required parameters are missing
  8323.       205: Too many parameters
  8324.       206: Number expected
  8325.       207: Number out of allowed range
  8326.       208: Illegal value for parameter
  8327.       209: Metastring syntax error
  8328.       211: Unable to locate DOS environment
  8329.  
  8330.  
  8331.       Chapter IX:ERROR MESSAGES                                 Page 154
  8332.  
  8333.  
  8334.  
  8335.  
  8336.                         Documentation for BATUTIL, Version 4.0
  8337.  
  8338.  
  8339.       212: Environment corrupted or not found
  8340.       213: Internal error in environment handling
  8341.       215: Too many variables in environment
  8342.       216: Environmental variable too large
  8343.       217: Environment too small for attempted change
  8344.       218: Error communicating with STACKEY
  8345.       220: SAVENV error: path not found
  8346.       221: SAVENV/LOADENV error: file access error
  8347.       222: LOADENV error: file not found
  8348.       223: LOADENV error: invalid environment in file
  8349.       224: LOADENV error: Too large environment in file
  8350.       225: WHILE, CASE or FOR syntax error
  8351.       226: Invalid path variable in environment
  8352.       227: Proposed new path is too long
  8353.       228: No matching THEN, RET, UNTIL, END or ENDCASE
  8354.       229: Unmatched RET, END, ENDCASE or UNTIL
  8355.       230: Drive not ready
  8356.       231: Other DOS disk error
  8357.       232: DOS unable to access drive {DRIVE LETTER}
  8358.       233: File error with $R read
  8359.       234: File or other error on writing to a file
  8360.       235: RUN error: Program not found
  8361.       236: RUN error: Insufficient memory to run program
  8362.       237: RUN error: DOS error
  8363.       238: RUN error: Swap file open error or bad path
  8364.       239: LABEL not found in GOTO or CALL command
  8365.       240: FECHO, FPRETTY, FMENU, FCOMMAND error: file not found
  8366.       241: FECHO, FPRETTY, FMENU, FCOMMAND error: label not found
  8367.       242: FECHO, FPRETTY, FMENU error: too many lines between labels
  8368.       243: FECHO, FPRETTY, FMENU, FCOMMAND error: no lines between labels
  8369.       245: Too many items in MENU or FMENU
  8370.       246: Improper FMENU lines
  8371.       247: Trace command syntax error
  8372.       248: Command stack overflow (limit of 1024 commands)
  8373.       249: Insufficient memory for requested operation
  8374.       250: Comparison error: No comparison given
  8375.       253: Turbo Pascal Runtime Error!
  8376.  
  8377.  
  8378.        IX.3 Explanation of Error Codes
  8379.  
  8380.       200: Not a BATUTIL command
  8381.                The first word inside each pair of {} or [] must be one of
  8382.       the BATUTIL commands or must be a valid truncation (have at least
  8383.  
  8384.  
  8385.       Chapter IX:ERROR MESSAGES                                 Page 155
  8386.  
  8387.  
  8388.  
  8389.  
  8390.                         Documentation for BATUTIL, Version 4.0
  8391.  
  8392.  
  8393.       the first two letters and the remaining letters agree with a
  8394.       BATUTIL command).
  8395. ==========================================================================
  8396.       201: Does not effect errorlevel; use {} not [ ]
  8397.             Some BATUTIL commands set the errorlevel and may be placed
  8398.       inside [] (see Section I.4).  You placed a command NOT of this
  8399.       type inside [].
  8400. ==========================================================================
  8401.       202: Incorrect placement of [,],{ or }
  8402.             BATUTIL was unable to parse the command line because of extra
  8403.       or missing brackets.  Here are some examples where you will get
  8404.       this error:
  8405.             batutil {}
  8406.             batutil {EC hi
  8407.             batutil {EC hi{
  8408. ==========================================================================
  8409.       204: Some of the required parameters are missing
  8410.             The command requires more parameters than you have given or
  8411.       you may have given no parameters.
  8412. ==========================================================================
  8413.       205: Too many parameters
  8414.             BATUTIL has found more parameters than it expected.  If you
  8415.       place a parameter with a space in it, you will often get this error
  8416.       since BATUTIL parses a space as a separator between parameters.  To
  8417.       place a space in most parameters, use $S.
  8418. ==========================================================================
  8419.       206: Number expected
  8420.             There are certain place where BATUTIL expects a number, e.g.
  8421.       in {AT xx} where xx should be a number.  If there is not a number
  8422.       there, then you'll get this message, for example if you type
  8423.             batutil {AT HI}
  8424. ==========================================================================
  8425.       207: Number out of allowed range
  8426.             In a command like {CO xx}, the parameter x must lie in the
  8427.       range 1 to 80 (unless proceeded by a + or -).  At least this is so
  8428.       if the screen is 80 columns wide.  You'll get this error if a
  8429.       number out of the allowed range is provided.
  8430. ==========================================================================
  8431.       208: Illegal value for parameter
  8432.             BATUTIL uses this to indicate some other error in the form of
  8433.       a parameter, e.g. {CU x} must have x equal to  + or - and you'll
  8434.       get this error if you use another value.  In some places, you'll
  8435.       get this error when error 205 might be more appropriate.
  8436. ==========================================================================
  8437.  
  8438.  
  8439.       Chapter IX:ERROR MESSAGES                                 Page 156
  8440.  
  8441.  
  8442.  
  8443.  
  8444.                         Documentation for BATUTIL, Version 4.0
  8445.  
  8446.  
  8447.       209: Metastring syntax error
  8448.             BATUTIL found an error when trying to do metastring
  8449.       translation.  This most often happens when a $ or a ^ is followed
  8450.       by an illegal character.  To place an actual $ or ^ in a string
  8451.       (which can then be followed by anything) remember to use $$ or $^.
  8452.       In addition, this error can occur when there is a syntax error with
  8453.       the $V or $s command.  for example, here are possible suberrors with
  8454.       the $V command:
  8455.             illegal character
  8456.             parenthesis mismatch
  8457.             spacing error
  8458.             operator missing next to parenthesis
  8459.             number too large
  8460.             negative powers illegal
  8461.             divide by zero
  8462. ==========================================================================
  8463.       211: Unable to locate DOS environment
  8464.             Please report this error to CTRLALT Associates.  Since
  8465.       BATUTIL will manipulate the true DOS environment, it is essential
  8466.       that it be found.  We believe that our method using undocumented
  8467.       information will always work but if BATUTIL cannot find what it is
  8468.       sure is the real environment, it will exit.  See the discussion of
  8469.       DRDOS above.
  8470. ==========================================================================
  8471.       212: Environment corrupted or not found
  8472.             Please report this error to CTRLALT Associates.  Since BATUTIL
  8473.       will manipulate the true DOS environment, it is essential that it be
  8474.       found.  We believe that our method using undocumented information will
  8475.       always work but if BATUTIL cannot find what it is sure is the real
  8476.       environment, it will exit.  This message indicates that BATUTIL found
  8477.       what it believes to be the DOS environment and it didn't have the
  8478.       proper form.  Either BATUTIL didn't find the true environment or your
  8479.       true environment is corrupted.  IMPORTANT NOTE: If you are using
  8480.       4DOS and get this error, only report it if you loaded 4DOS with the
  8481.       /M:xxx parameter.  BATUTIL is incompatible with versions of 4DOS
  8482.       prior to 2.1 or ones not loaded with /M.
  8483. ==========================================================================
  8484.       213: Internal error in environment handling
  8485.             Please report this error to CTRLALT Associates.  Since
  8486.       BATUTIL will manipulate the true DOS environment, it is essential
  8487.       that it be found.  We believe that our method using undocumented
  8488.       information will always work but if BATUTIL cannot find what it is
  8489.       sure is the real environment, it will exit.
  8490. ==========================================================================
  8491.  
  8492.  
  8493.       Chapter IX:ERROR MESSAGES                                 Page 157
  8494.  
  8495.  
  8496.  
  8497.  
  8498.                         Documentation for BATUTIL, Version 4.0
  8499.  
  8500.  
  8501.       215: Too many variables in environment
  8502.             BATUTIL cannot handle environments with more than 510
  8503.       different strings in it.  If you have more than that many strings,
  8504.       let us know - we're curious what you could possibly have there!
  8505. ==========================================================================
  8506.       216: Environmental variable too large
  8507.             BATUTIL cannot handle environments where any string has more
  8508.       than 255 characters.  Normally, you shouldn't have any such strings
  8509.       since DOS only allows strings up to 127 characters and BATUTIL only
  8510.       up to 255.  Let us know if you'd like this limit of 255 increased.
  8511. ==========================================================================
  8512.       217: Environment too small for attempted change
  8513.             You tried, e.g. with a {SE  } command to place something in
  8514.       the environment for which there was insufficient room.
  8515. ==========================================================================
  8516.       218: Error communicating with STACKEY
  8517.             This will happen in three different contexts:
  8518.               - you try the SKEY command and STACKEY is not resident
  8519.               - the STACKEY buffer would overflow if your request is
  8520.                   processed
  8521.               - you made a syntax error in what you placed after the SKey
  8522.                  command
  8523.       In either of the later cases, the STACKEY buffer will be flushed.
  8524. ==========================================================================
  8525.       220: SAVENV error: path not found
  8526.             The directory part of the filespec in
  8527.                  {SA filespec}
  8528.       was invalid.
  8529. ==========================================================================
  8530.       221: SAVENV/LOADENV error: file access error
  8531.             There was a disk or other error that prevented access to
  8532.       the file in question.  The most common cause of this will be a disk
  8533.       full or write protected disk during a SAVENV.  The error message
  8534.       displayed on the screen will give extra information (ignore the
  8535.       extra error number given).
  8536. ==========================================================================
  8537.       222: LOADENV error: file not found
  8538.             The file which you asked to have loaded into the environment
  8539.       could not be found.
  8540. ==========================================================================
  8541.       223: LOADENV error: invalid environment in file
  8542.             There was a line in the file you asked to have loaded into
  8543.       the environment or it did not have the form
  8544.             INCAPS=string
  8545.  
  8546.  
  8547.       Chapter IX:ERROR MESSAGES                                 Page 158
  8548.  
  8549.  
  8550.  
  8551.  
  8552.                         Documentation for BATUTIL, Version 4.0
  8553.  
  8554.  
  8555.       on each line.  A file obtained with {SAvenv} should always load
  8556.       without this message.  If you get this message with a file saved
  8557.       with BATUTIL, please notify CTRLALT Associates.
  8558. ==========================================================================
  8559.       224: LOADENV error: Too large environment in file
  8560.             No room in the DOS environment for the file you tried to load.
  8561. ==========================================================================
  8562.       225: WHILE, CASE or FOR syntax error
  8563.             This can happen in the following places:
  8564.               - you try to nest CASE statements
  8565.               - your file/fordir/explicit list has more than 500 items
  8566.               - you used FOR..IN without (..) after the IN
  8567.               - you used an illegal loop variable with FOR $?=
  8568.               - you didn't follow FOR $? with IN or =
  8569.               - with FOR $?= start TO stop, start or stop was invalid
  8570.               - the required TO was left out of FOR $?=...
  8571.               - the required DO was left off a WHILE statement
  8572. ==========================================================================
  8573.       226: Invalid path variable in environment
  8574.             In parsing the path for a {DElpath ...} or {ADdpath ...}
  8575.       command, BATUTIL found an invalid path.  Valid paths have strings
  8576.       without spaces separated by semicolons with an optional semicolon
  8577.       at the end.  DOS will accept invalid path strings with its PATH
  8578.       command.
  8579. ==========================================================================
  8580.       227: Proposed new path is too long
  8581.             BATUTIL limits environmental strings to 255 bytes each.  Your
  8582.       attempt to use {ADdpath ...} or {PAthedit} would have resulting in
  8583.       path in excess of 255 characters and so it was not accomplished.  Let
  8584.       us know if you'd like to have paths over 255 characters.
  8585. ==========================================================================
  8586.       228: No matching THEN, RET, UNTIL, END or ENDCASE
  8587.             You had an unmatched multicommand start without a closing stop
  8588.       normally one of
  8589.             IF but no THEN
  8590.             a CALL with no RET
  8591.             REPEAT but no UNTIL
  8592.             BEGIN but no END
  8593.             CASE but no ENDCASE
  8594. ==========================================================================
  8595.       229: Unmatched RET, END, ENDCASE or UNTIL
  8596.             You had an unmatched multicommand stop without a start normally
  8597.       one of
  8598.             RET without a matching LAbel or not in a CALL
  8599.  
  8600.  
  8601.       Chapter IX:ERROR MESSAGES                                 Page 159
  8602.  
  8603.  
  8604.  
  8605.  
  8606.                         Documentation for BATUTIL, Version 4.0
  8607.  
  8608.  
  8609.             END without a BEGIN
  8610.             ENDCASE without a CASE
  8611.             UNTIL without a REPEAT
  8612.       Note that you cannot use a label for both a CALL and GOTO because of
  8613.       the matching RET requirement.
  8614. ==========================================================================
  8615.       230: Drive not ready
  8616.             DOS error - usually due to an open diskette drive door.
  8617. ==========================================================================
  8618.       231: Other DOS disk error
  8619.             DOS wouldn't allow access to the file and reported an error
  8620.       other than Drive not ready.
  8621. ==========================================================================
  8622.       232: DOS unable to access drive {DRIVE LETTER}
  8623.             Used by the #Disk and @Disk commands to indicate either error
  8624.       230 or 231.
  8625. ==========================================================================
  8626.       233: File error with $R read
  8627.             Either you failed to specify a file to read from (!) or there
  8628.       was a DOS file error.
  8629. ==========================================================================
  8630.       234: File or other error on writing to a file
  8631.             Either you failed to specify a file to write to (!) or there
  8632.       was a DOS file error.
  8633. ==========================================================================
  8634.       235: RUN error: Program not found
  8635.             The program name after a {RUn ...} command wasn't in the
  8636.       current directory or on the path (or in the directory name that you
  8637.       gave).  RUn can only run EXE and COM programs and not batch files or
  8638.       internal commands.  To run batch files or internal commands use
  8639.       command /c as in
  8640.             {RUN command /ccopy $1 $2}
  8641. ==========================================================================
  8642.       236: RUN error: Insufficient memory to run program
  8643.             DOS reported insufficient free memory to run the program you
  8644.       asked to RUn.
  8645. ==========================================================================
  8646.       237: RUN error: DOS error
  8647.             DOS reported an error when trying to run the program that you
  8648.       asked to RUn.  All these errors are unusual and you should report any
  8649.       such message to CTRLALT Associates together with the extra "special
  8650.       error number" which was reported.
  8651. ==========================================================================
  8652.       238: RUN error: Swap file open error or bad path
  8653.  
  8654.  
  8655.       Chapter IX:ERROR MESSAGES                                 Page 160
  8656.  
  8657.  
  8658.  
  8659.  
  8660.                         Documentation for BATUTIL, Version 4.0
  8661.  
  8662.  
  8663.             Either you specified an invalid path in BUSWAP or there was a
  8664.       DOS file error in trying to access the swapfile in a RUN with swap.
  8665. ==========================================================================
  8666.       239: LABEL not found in GOTO or CALL command
  8667.             The label specified in a GOTO or CALL was not found AND an ELSE
  8668.       label wasn't found either.
  8669. ==========================================================================
  8670.       240: FECHO, FPRETTY, FMENU, FCOMMAND error: file not found
  8671.             In {FEcho filename label}, the file filename could not be
  8672.       found or similarly for FPretty, FMenu or FCommand.
  8673. ==========================================================================
  8674.       241: FECHO, FPRETTY, FMENU, FCOMMAND error: label not found
  8675.             In {FEcho filename label}, the label could not be found or
  8676.       similarly for FPretty, FMenu or FCommand.
  8677. ==========================================================================
  8678.       242: FECHO, FPRETTY, FMENU error: too many lines between labels
  8679.             These commands can only read in 25 lines (which is all you'd
  8680.       normally want!) and will give an error if the end of the file or
  8681.       another label is not reached before 26 lines (exclusive of
  8682.       comments) are read.
  8683. ==========================================================================
  8684.       243: FECHO, FPRETTY, FMENU, FCOMMAND error: no lines between labels
  8685.             Either the first line in a file where no label was given or
  8686.       the line following the label give was itself a label line (i.e.
  8687.       began with :).
  8688. ==========================================================================
  8689.       245: Too many items in MENU or FMENU
  8690.             Menus are limited to 16 choices.
  8691. ==========================================================================
  8692.       246: Improper FMENU lines
  8693.             The first line in FMENU began with an @ which is only used to
  8694.       separate menu items from help text.
  8695. ==========================================================================
  8696.       247: Trace command syntax error
  8697.             Invalid parameter used with the TRace command.
  8698. ==========================================================================
  8699.       248: Command stack overflow (limit of 1024 commands)
  8700.             You tried to read in more than 1024 commands in a FCommand or
  8701.       else a translation of a CASE or FOR produced a set of commands with
  8702.       more than 1024 commands in it.
  8703. ==========================================================================
  8704.       249: Insufficient memory for requested operation
  8705.             BATUTIL had insufficient memory to process a command; normally
  8706.       this will only happen if you have a non-terminating nest due to
  8707.  
  8708.  
  8709.       Chapter IX:ERROR MESSAGES                                 Page 161
  8710.  
  8711.  
  8712.  
  8713.  
  8714.                         Documentation for BATUTIL, Version 4.0
  8715.  
  8716.  
  8717.       improper code.  BATUTIL stores information in a 'heap' which is about
  8718.       300K less than the amount of free memory when BATUTIL loads. Internal
  8719.       variables are stored there as well as all commands and roughly 6K
  8720.       overhead for each 'command level'.
  8721. ==========================================================================
  8722.       250: Comparison error: No comparison given
  8723.              Each HAltif parameter and every comparison associated to an
  8724.       IF, WHILE or REPEAT must have an =, > or < (NOTE: IF YOU USE THE DOS
  8725.       COMMAND LINE THE > OR < MUST BE ENTERED AS $g OR $l TO AVOID A DOS
  8726.       REDIRECTION).
  8727. ==========================================================================
  8728.       253: Turbo Pascal Runtime Error!
  8729.             Most errors indicate mistakes you made or system errors but
  8730.       if you get this message, it means that we made an error because we
  8731.       failed to catch an error and the underlying Turbo Pascal code was
  8732.       called into play.  Please report the problem to us with the extra
  8733.       information displayed on the screen.
  8734. ===========================================================================
  8735.  
  8736.  
  8737.  
  8738.  
  8739.  
  8740.  
  8741.  
  8742.  
  8743.  
  8744.  
  8745.  
  8746.  
  8747.  
  8748.  
  8749.  
  8750.  
  8751.  
  8752.  
  8753.  
  8754.  
  8755.  
  8756.  
  8757.  
  8758.  
  8759.  
  8760.  
  8761.  
  8762.  
  8763.       Chapter IX:ERROR MESSAGES                                 Page 162
  8764.  
  8765.  
  8766.  
  8767.  
  8768.    INDEX
  8769.  
  8770.    #Altmon           30, 113               BIgchar               129
  8771.    #Comm             32, 113               BIGECHO                47
  8772.    #Disk             29, 113               BOx               45, 129
  8773.    #Env              29, 113               BPretty               130
  8774.    #Floppy           32, 114               buffers, DOS           27
  8775.    #Game             32, 114               BUSIC                  90
  8776.    #Intel            31, 114               CALL              92, 130
  8777.    #Keyboard         30, 114               CArousel          28, 130
  8778.    #Lim              28, 114               CASE statement    96, 131
  8779.    #Mem              28, 115               CHeck             34, 131
  8780.    #Prn              31, 115               CLs               45, 131
  8781.    #Rodent           31, 115               COl           50, 62, 131
  8782.    #Terminal         29, 115               Control Break          23
  8783.    #Vmode            30, 115               count, character       83
  8784.    #Whichmon         30, 116               count, word            83
  8785.    #Xtended          28, 116               CSent             60, 132
  8786.    $%                    117               CUrsor        17, 51, 132
  8787.    $L                     63               DAte              26, 132
  8788.    $r                     15               date arithmetic    41, 86
  8789.    $R(con)               119               dates, European        11
  8790.    $Rtranslate       88, 120               debugging        102, 151
  8791.    $s                     82               DElpath           78, 132
  8792.    $Translate        39, 122               DOs               27, 133
  8793.    $V                     84               DRDOS                 154
  8794.    $Wtranslate       88, 120               DRive             27, 133
  8795.    $Z                    121               DView             28, 133
  8796.    $z                    121               ECho              43, 134
  8797.    ++                     84               EDitenv           80, 135
  8798.    --                     84               ELSE                  135
  8799.    4DOS            9, 27, 69               END                   135
  8800.    ?Length           72, 124               ENDCASE               135
  8801.    ?Size             72, 124               environment        16, 67
  8802.    @Ansi             30, 124               environment, loading   76
  8803.    @Disk             29, 124               environment, saving    76
  8804.    @Env              29, 125               ENvrep            69, 135
  8805.    @Floppy           32, 125               EOline            45, 136
  8806.    @Intel            31, 125               ERrorlevel    14, 38, 136
  8807.    @Lim              28, 125               European dates    11, 134
  8808.    @Mem              28, 125               EXist             32, 136
  8809.    @Prn              31, 126               Fatal Errors          154
  8810.    @Terminal         30, 126               FCommand               17
  8811.    @Xtended          28, 126               FDir              33, 137
  8812.    ^Translate        39, 127               FEcho             17, 137
  8813.    ADdpath           78, 127               file handles           27
  8814.    arithmetic             84               file pick list         75
  8815.    AScii                  63               filename parsing       41
  8816.    ASciiread             127               FKey              56, 137
  8817.    ATtribute         45, 128               FMenu         17, 56, 138
  8818.    BEcho             47, 128               FOR                   138
  8819.    BEGIN                 128               FOR list               98
  8820.  
  8821.  
  8822.    FOR statement          96               PIANOMAN               52
  8823.    FORDIR            98, 138               pick list              75
  8824.    format                 83               PMatch            64, 145
  8825.    FPretty           17, 138               pokes                 105
  8826.    GEtkey        58, 60, 139               POp               56, 146
  8827.    GOto              92, 139               PRetty            46, 146
  8828.    hacker mode      105, 139               PROMPT metastrings     39
  8829.    help                    9               PUt               82, 146
  8830.    HImem             28, 139               QLock             65, 147
  8831.    HOur              26, 140               QUery             72, 147
  8832.    IF...THEN...ELSE  94, 140               Quiet mode        10, 146
  8833.    INclude           17, 140               RC                82, 147
  8834.    ins                   105               Read from file         88
  8835.    internal variables     81               registration            4
  8836.    IOerror           88, 140               REPEAT            97, 147
  8837.    IS_A_DEVICE.           34               RET                   148
  8838.    ISnum             84, 141               ROw           50, 62, 148
  8839.    KIllenv           76, 141               RUn               34, 148
  8840.    LAbel         18, 92, 141               SAvenv            76, 148
  8841.    laptop                 10               saving the environment 76
  8842.    lastdrive              27               SCanread          63, 149
  8843.    LEngth            72, 141               SEt               70, 149
  8844.    LIm               27, 142               SHadow            56, 149
  8845.    line editor            19               share                  27
  8846.    LOadenv           76, 142               SKey                  149
  8847.    loading the environment76               SOund             52, 150
  8848.    Lock status            65               STACKEY metastrings    40
  8849.    lowercase              83               standard output        51
  8850.    MAkefile          38, 142               STdout            51, 150
  8851.    MEnu          54, 56, 142               string manipulation
  8852.    menu waits             58                                 82, 120
  8853.    MENUDEMO               55               substring              83
  8854.    menus                 106               supermetastring        15
  8855.    metastrings            39               Supermetastring       116
  8856.    MHeader           56, 143               syntax                 13
  8857.    Microsoft Windows      27               THEN                  150
  8858.    minimal truncation     14               TO                    150
  8859.    MInute                 26               TOdayfile         37, 151
  8860.    MInute            26, 143               TRace            102, 151
  8861.    MNattribute       45, 143               UNTIL                 151
  8862.    MOnth             26, 143               uppercase              83
  8863.    NBeep             79, 144               USername          63, 152
  8864.    NDOS                   27               Verbose mode      10, 152
  8865.    NFlush            60, 144               VIsual            60, 152
  8866.    NMouse            54, 144               waits, menu            58
  8867.    NSound            52, 144               WARNING                68
  8868.    NUmberfiles       34, 144               watch                 104
  8869.    OF                    145               WEekday           26, 152
  8870.    outs                  105               WHATEL                 35
  8871.    OView                  28               WHILE statement        97
  8872.    parsing                41               Windows                27
  8873.    path control           78               word count             83
  8874.    PAthedit          79, 145               Write to file          88
  8875.    Pause mode        10, 145               Year              26, 153
  8876.    peeks                 105
  8877.